The Servo Book - 0.0.1selected element. The entries here come from the element's style attribute, from matching stylesheet rules, or inherited from other elements. Styles can be added or modified by clicking on a selector or property structure holds all the selectors and device characteristics for a given document. The stylesheets' CSS rules are converted into Rule s. They are then introduced in a SelectorMap depending on the pseudo-element flow), table formatting contexts, and flex formatting contexts. Each formatting context has different rules for how boxes inside that context are laid out. Servo represents this tree of contexts using nested0 码力 | 107 页 | 2.48 MB | 3 天前3
Rust 程序设计语言 简体中文版 1.85.0的历史是因为更多的明确的模式被合并和添加到编译器中是完全可能 的。未来可能只需要更少的生命周期注解。 被编码进 Rust 引用分析的模式被称为 生命周期省略规则(lifetime elision rules)。这并不是需 要程序员遵守的规则;这些规则是一系列特定的场景,此时编译器会考虑,如果代码符合这些 场景,就无需明确指定生命周期。 省略规则并不提供完整的推断。如果 Rust 在明确遵守这些规则的前提下变量的生命周期仍然 程序设计语言 简体中文版 宏 我们已经在本书中使用过像 println! 这样的宏了,不过尚未深入探讨什么是宏以及它是如何 工作的。宏(Macro)指的是 Rust 中一系列的功能:使用 macro_rules! 的 声明宏 (declarative macro),和三种 过程宏(procedural macro): • 自定义 #[derive] 宏,用于在结构体和枚举上通过添加 derive 属性生成代码 用宏 之前 必须定义它,或将其引入作用 域,而函数则可以在任何地方定义和调用。 使用 macro_rules! 的声明宏用于通用元编程 Rust 最常用的宏形式是 声明宏(declarative macros)。它们有时也被称为 “macros by example”、“macro_rules! 宏” 或者就是 “macros”。其核心概念是,声明宏允许我们编写一些 类似 Rust match0 码力 | 562 页 | 3.23 MB | 1 月前3
共 2 条
- 1













