2020年12月24日

摘要: https://pkg.go.dev/gvisor.dev/gvisor@v0.0.0-20201222062610-620de250a48a?tab=versions https://cloud-atlas.readthedocs.io/zh_CN/latest/kubernetes/virtua 阅读全文
posted @ 2020-12-24 19:54 tycoon3 阅读(883) 评论(0) 推荐(0)
摘要: gVisor gVisor is a user-space kernel, written in Go, that implements a substantial portion of the Linux system surface. gVisor uses linux OS, but the 阅读全文
posted @ 2020-12-24 19:26 tycoon3 阅读(143) 评论(0) 推荐(0)
摘要: Deref <T> trait用于自定义解除引用运算符(*)的行为。如果实现Deref <T>特征,则可以将智能指针视为参考。 因此,在引用上工作的代码也可以用在智能指针上。 常规引用 常规引用是一种指向某个值的指针,该值存储在其他地方。下面来看一个简单的例子来创建i32类型值的引用,然后使用引用运 阅读全文
posted @ 2020-12-24 17:57 tycoon3 阅读(456) 评论(0) 推荐(0)
摘要: cat src/main.rs // 生命周期 `'a` 和 `'b`。这两个生命周期都必须至少要和 `print_refs` // 函数的一样长。 fn print_refs<'a, 'b>(x: &'a i32, y: &'b i32) { println!("x is {} and y is 阅读全文
posted @ 2020-12-24 17:43 tycoon3 阅读(83) 评论(0) 推荐(0)
摘要: // 此函数取倒堆分配的内存的所有权 fn destroy_box(c: Box<i32>) { println!("Destroying a box that contains {}", c); // `c` 被销毁且内存得到释放 } fn main() { // 栈分配的整型 let x = 5 阅读全文
posted @ 2020-12-24 17:20 tycoon3 阅读(237) 评论(0) 推荐(0)
摘要: Drop Drop trait 只有一个方法:drop,当一个对象离开作用域时会自动调用该方法。Drop trait 的主要作用是释放实现者实例拥有的资源。 Box,Vec,String,File,以及 Process 是一些实现了 Drop trait 来释放资源的类型的例子。Drop trait 阅读全文
posted @ 2020-12-24 17:10 tycoon3 阅读(199) 评论(0) 推荐(0)
摘要: 变量绑定默认是不可变的,但加上 mut 修饰语后变量就可以改变。 fn main() { let _immutable_binding = 1; let mut mutable_binding = 1; println!("Before mutation: {}", mutable_binding) 阅读全文
posted @ 2020-12-24 17:03 tycoon3 阅读(198) 评论(0) 推荐(0)
摘要: cat src/main.rs use std::rc::Rc; struct Owner { name: String, // ...other fields } struct Gadget { id: i32, owner: Rc<Owner>, // ...other fields } fn 阅读全文
posted @ 2020-12-24 16:53 tycoon3 阅读(220) 评论(0) 推荐(0)
摘要: 高级编程 https://learnku.com/docs/nomicon/2018/33-life-cycle/4714 rust-by-example- http://llever.com/rust-by-example-cn/variable_bindings/mut.html 箱子、栈和堆 阅读全文
posted @ 2020-12-24 16:13 tycoon3 阅读(318) 评论(0) 推荐(0)
摘要: cat src/main.rs fn main() { let x= String::from("42"); let y=x; println!("value of x :{}",x); } cargo build Compiling own v0.1.0 (/data2/rust/own) war 阅读全文
posted @ 2020-12-24 15:58 tycoon3 阅读(449) 评论(0) 推荐(0)
摘要: demo1 fn main() { let a = 5; let b = &a; if a == *b { println!("Equal"); } else { println!("Not equal"); } } cargo run Finished dev [unoptimized + deb 阅读全文
posted @ 2020-12-24 15:16 tycoon3 阅读(179) 评论(0) 推荐(0)
摘要: Anbox 实现分析 3:会话管理器与容器管理器的通信 Anbox源码分析 https://blog.csdn.net/qq_36383272/category_9934190.html Anbox 实现分析之 I/O 模型 https://blog.csdn.net/tq08g2z/article 阅读全文
posted @ 2020-12-24 10:08 tycoon3 阅读(999) 评论(0) 推荐(0)

导航