pub struct GraftPlanDocument {
pub version: u32,
pub target: NodeId,
pub target_path: String,
pub graft: String,
pub full: bool,
}Expand description
One external overlay declaration as written to graft.plan.
写进 graft.plan 的一条外部覆盖声明。
Fields§
§version: u32Layout version; must equal GRAFT_PLAN_VERSION.
版式版本;必须等于 GRAFT_PLAN_VERSION。
target: NodeIdCompile-time identity of the target face in the base tree. 原树中目标注册面的编译期身份。
target_path: StringThe target’s logical path, for humans and for string-selector overlays. 目标的逻辑路径,供人阅读,也供字符串选择器的 overlay 使用。
graft: StringName, path, or identity of the external implementation’s face. 外部实现注册面的名称、路径或身份。
full: boolWhether the whole subtree rooted at the target is replaced. 是否替换目标根节点下的整棵子树。
Implementations§
Source§impl GraftPlanDocument
impl GraftPlanDocument
Sourcepub fn new(
target: NodeId,
target_path: impl Into<String>,
graft: impl Into<String>,
full: bool,
) -> GraftPlanDocument
pub fn new( target: NodeId, target_path: impl Into<String>, graft: impl Into<String>, full: bool, ) -> GraftPlanDocument
The declaration a freshly created plan carries. 新建计划携带的声明。
Sourcepub fn parse(source: &str) -> Result<GraftPlanDocument, GraftPlanDocumentError>
pub fn parse(source: &str) -> Result<GraftPlanDocument, GraftPlanDocumentError>
Parse a plan document, refusing anything this version cannot read. 解析计划文档;读不懂的内容一律拒绝,而不是猜。
Sourcepub fn render(&self) -> String
pub fn render(&self) -> String
Render the canonical document, one key=value per line.
渲染规范文档,每行一个 key=value。
Sourcepub fn declaration(&self) -> String
pub fn declaration(&self) -> String
The cut … graft … clause a host entry writes inside
static_graft_plan!.
宿主入口写在 static_graft_plan! 里的 cut … graft … 子句。
The string form needs no linked external implementation, which is why it is the form tooling can generate: the implementation may arrive later as a plugin, and the compiler is not asked to resolve a crate the author has not written yet. 字符串写法不需要链接外部实现,这正是工具能生成它的原因:实现可以稍后作为插件 到位,也不必要求编译器解析作者还没写的 crate。
Trait Implementations§
Source§impl Clone for GraftPlanDocument
impl Clone for GraftPlanDocument
Source§fn clone(&self) -> GraftPlanDocument
fn clone(&self) -> GraftPlanDocument
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more