上一页 1 ··· 57 58 59 60 61 62 63 64 65 ··· 119 下一页
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/rust-by-example/scope/lifetime/lifetime_coercion.html 示例 main.rs // Rust 自动推导了生存期,两个参数都被申 阅读全文
posted @ 2021-12-23 17:57 jiangbo4444 阅读(73) 评论(0) 推荐(0)
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/rust-by-example/scope/lifetime/lifetime_bounds.html 示例 main.rs use std::fmt::Debug; // 包含 阅读全文
posted @ 2021-12-23 17:56 jiangbo4444 阅读(67) 评论(0) 推荐(0)
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/stable/rust-by-example/scope/lifetime/trait.html 示例 main.rs #[derive(Debug)] struct Borro 阅读全文
posted @ 2021-12-17 20:45 jiangbo4444 阅读(71) 评论(0) 推荐(0)
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/stable/rust-by-example/scope/lifetime/struct.html 示例 main.rs #[derive(Debug)] struct Borr 阅读全文
posted @ 2021-12-17 20:44 jiangbo4444 阅读(69) 评论(0) 推荐(0)
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/stable/rust-by-example/scope/lifetime/methods.html 示例 main.rs struct Owner(i32); impl Own 阅读全文
posted @ 2021-12-17 20:43 jiangbo4444 阅读(89) 评论(0) 推荐(0)
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/stable/rust-by-example/scope/lifetime/fn.html 示例 main.rs fn print_one<'a>(x: &'a i32) { p 阅读全文
posted @ 2021-12-17 20:42 jiangbo4444 阅读(76) 评论(0) 推荐(0)
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/stable/rust-by-example/scope/lifetime.html 示例 生存期(lifetime),也叫生命周期等,rust 使用生存期来保证所有的借用都是有 阅读全文
posted @ 2021-12-17 20:14 jiangbo4444 阅读(125) 评论(0) 推荐(0)
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/stable/rust-by-example/scope/lifetime/explicit.html 示例 生存期的标注,使用撇号来标注。 main.rs // 标注了两个生存 阅读全文
posted @ 2021-12-17 20:14 jiangbo4444 阅读(80) 评论(0) 推荐(0)
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/stable/rust-by-example/scope/borrow/ref.html 示例 取引用可以使用 & 和 ref 关键字,它们有各自的使用场景。 main.rs # 阅读全文
posted @ 2021-12-17 20:12 jiangbo4444 阅读(102) 评论(0) 推荐(0)
摘要: 环境 Rust 1.56.1 VSCode 1.61.2 概念 参考:https://doc.rust-lang.org/stable/rust-by-example/scope/borrow/alias.html 示例 进行借用时,可以以不可变借用多次。但是在不可变借用的时候,不能进行可变借用。同 阅读全文
posted @ 2021-12-17 20:11 jiangbo4444 阅读(482) 评论(0) 推荐(0)
上一页 1 ··· 57 58 59 60 61 62 63 64 65 ··· 119 下一页