Skip to main content

GraftPlanDocument

Struct GraftPlanDocument 

Source
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: u32

Layout version; must equal GRAFT_PLAN_VERSION. 版式版本;必须等于 GRAFT_PLAN_VERSION。

§target: NodeId

Compile-time identity of the target face in the base tree. 原树中目标注册面的编译期身份。

§target_path: String

The target’s logical path, for humans and for string-selector overlays. 目标的逻辑路径,供人阅读,也供字符串选择器的 overlay 使用。

§graft: String

Name, path, or identity of the external implementation’s face. 外部实现注册面的名称、路径或身份。

§full: bool

Whether the whole subtree rooted at the target is replaced. 是否替换目标根节点下的整棵子树。

Implementations§

Source§

impl GraftPlanDocument

Source

pub fn new( target: NodeId, target_path: impl Into<String>, graft: impl Into<String>, full: bool, ) -> GraftPlanDocument

The declaration a freshly created plan carries. 新建计划携带的声明。

Source

pub fn parse(source: &str) -> Result<GraftPlanDocument, GraftPlanDocumentError>

Parse a plan document, refusing anything this version cannot read. 解析计划文档;读不懂的内容一律拒绝,而不是猜。

Source

pub fn render(&self) -> String

Render the canonical document, one key=value per line. 渲染规范文档,每行一个 key=value。

Source

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

Source§

fn clone(&self) -> GraftPlanDocument

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GraftPlanDocument

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for GraftPlanDocument

Source§

impl PartialEq for GraftPlanDocument

Source§

fn eq(&self, other: &GraftPlanDocument) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GraftPlanDocument

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.