The Servo Book - 0.0.1tools package, which also contains a copy of the OpenHarmony SDK. 1. Go to the OpenHarmony release notes and select the version you want to compile for. 2. Scroll down to the section "Acquiring Source Code recommend that you add the following to your project specific settings in .vscode/settings.json : Notes: In the above excerpt, the language server is building into its own target directory, target/lsp0 码力 | 107 页 | 2.48 MB | 1 天前3
Rust 程序设计语言 简体中文版 1.85.0引用的值可能已经被丢弃了,为了使用 Weak所指向的值,我们必须确保其值 仍然有效。为此可以调用 Weak 实例的 upgrade 方法,这会返回 Option >。如果 Rc 值还未被丢弃,则结果是 Some;如果 Rc 已被丢弃,则结果是 None。因为 upgrade 返回一个 Option >,Rust 会确保处理 Some 和 None 的情况,所以它不会返回无效指针。 children: RefCell::new(vec![]), }); println!("leaf parent = {:?}", leaf.parent.borrow().upgrade()); let branch = Rc::new(Node { value: 5, parent: RefCell::new(Weak::new()) borrow().upgrade()); } 示例 15-28:一个 leaf 节点,其拥有指向其父节点 branch 的弱引用 创建 leaf 节点类似于示例 15-27,除了 parent 字段有所不同:leaf 开始时没有父节点,所 以我们新建了一个空的 Weak 引用实例。 351/562Rust 程序设计语言 简体中文版 此时,当尝试使用 upgrade 方法获取 leaf 0 码力 | 562 页 | 3.23 MB | 1 月前3
共 2 条
- 1













