网站首页 站内搜索

搜索结果

查询Tags标签: rust,共有 227条记录
  • 【Rust】loop 循环

    环境Rust 1.56.1 VSCode 1.60.2概念 参考:https://doc.rust-lang.org/stable/rust-by-example/flow_control/loop.html 使用 loop 关键字来定义一个无限循环。 示例 loop 循环 在 loop 循环中,可以使用 break 跳出循环,使用 continue 继续下次循环。 fn main() {let mu…

    2021/11/30 23:36:29 人评论 次浏览
  • 【Rust】条件判断

    环境Rust 1.56.1 VSCode 1.60.2概念 参考:https://doc.rust-lang.org/stable/rust-by-example/flow_control/if_else.html Rust 中的 if/else 条件判断,条件可以不使用小括号,但是后面的代码需要使用大括号。 示例 if/else fn main() {let n = 5;if n < 0 {print!(&…

    2021/11/30 23:36:24 人评论 次浏览
  • 【Rust】条件判断

    环境Rust 1.56.1 VSCode 1.60.2概念 参考:https://doc.rust-lang.org/stable/rust-by-example/flow_control/if_else.html Rust 中的 if/else 条件判断,条件可以不使用小括号,但是后面的代码需要使用大括号。 示例 if/else fn main() {let n = 5;if n < 0 {print!(&…

    2021/11/30 23:36:24 人评论 次浏览
  • 【Rust】文件文档注释

    环境Rust 1.54.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/hello/comment.html 文档注释(doc comments):文档注释会对外公开,使用者一般在使用之前,会进行阅读。 文档注释包含两种,这里介绍第二种:/// 为接下来的项(the follow…

    2021/11/30 23:10:32 人评论 次浏览
  • 【Rust】文件文档注释

    环境Rust 1.54.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/hello/comment.html 文档注释(doc comments):文档注释会对外公开,使用者一般在使用之前,会进行阅读。 文档注释包含两种,这里介绍第二种:/// 为接下来的项(the follow…

    2021/11/30 23:10:32 人评论 次浏览
  • 【Rust】函数文档注释

    环境Rust 1.54.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/hello/comment.html 文档注释(doc comments):文档注释会对外公开,使用者一般在使用之前,会进行阅读。 文档注释包含两种,这里介绍第一种:/// 为接下来的项(the follow…

    2021/11/30 23:10:31 人评论 次浏览
  • 【Rust】函数文档注释

    环境Rust 1.54.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/hello/comment.html 文档注释(doc comments):文档注释会对外公开,使用者一般在使用之前,会进行阅读。 文档注释包含两种,这里介绍第一种:/// 为接下来的项(the follow…

    2021/11/30 23:10:31 人评论 次浏览
  • 【Rust】块注释

    环境Rust 1.54.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/hello/comment.html 块注释(block comments):当代码逻辑很复杂,需要额外说明时,可以使用块注释来帮助人们理解。块注释会直接被编译器忽略,注释的有效范围可以多行。示例…

    2021/11/30 23:07:46 人评论 次浏览
  • 【Rust】块注释

    环境Rust 1.54.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/hello/comment.html 块注释(block comments):当代码逻辑很复杂,需要额外说明时,可以使用块注释来帮助人们理解。块注释会直接被编译器忽略,注释的有效范围可以多行。示例…

    2021/11/30 23:07:46 人评论 次浏览
  • 【Rust】枚举

    环境Rust 1.55.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/custom_types/enum.html enum 关键字允许创建一个从数个不同取值中选其一的枚举类型(enumeration)。 任何一个在 struct 中合法的取值在 enum 中也合法。 示例 enum WebEven…

    2021/11/30 23:07:39 人评论 次浏览
  • 【Rust】枚举

    环境Rust 1.55.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/custom_types/enum.html enum 关键字允许创建一个从数个不同取值中选其一的枚举类型(enumeration)。 任何一个在 struct 中合法的取值在 enum 中也合法。 示例 enum WebEven…

    2021/11/30 23:07:39 人评论 次浏览
  • 【Rust】结构体-area

    环境Rust 1.55.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/custom_types/structs.html Add a function rect_area which calculates the area of a Rectangle (try using nested destructuring). 示例 struct Point {x: f32,y: f32, }s…

    2021/11/30 23:07:12 人评论 次浏览
  • 【Rust】结构体-area

    环境Rust 1.55.0 VSCode 1.59.1概念 参考:https://doc.rust-lang.org/stable/rust-by-example/custom_types/structs.html Add a function rect_area which calculates the area of a Rectangle (try using nested destructuring). 示例 struct Point {x: f32,y: f32, }s…

    2021/11/30 23:07:12 人评论 次浏览
  • The Rust Programming Language - 第17章 Rust的面向对象编程特性 - 17.2 为使用不同类型的值而设计的trait对象

    17 Rust的面向对象编程特性 面向对象编程(OOP)是一种模式话编程方式 17.2 为使用不同类型的值而设计的trait对象 之前我们了解了vector,它有个缺陷就是只能存储同类型的元素,但是我们可以使用枚举或者结构体来存储不同类型的数据 但是呢,在实际中,我们希望这种类型的…

    2021/11/29 22:06:22 人评论 次浏览
  • The Rust Programming Language - 第17章 Rust的面向对象编程特性 - 17.2 为使用不同类型的值而设计的trait对象

    17 Rust的面向对象编程特性 面向对象编程(OOP)是一种模式话编程方式 17.2 为使用不同类型的值而设计的trait对象 之前我们了解了vector,它有个缺陷就是只能存储同类型的元素,但是我们可以使用枚举或者结构体来存储不同类型的数据 但是呢,在实际中,我们希望这种类型的…

    2021/11/29 22:06:22 人评论 次浏览
扫一扫关注最新编程教程