Skip to main content

StaticPlan

Struct StaticPlan 

Source
pub struct StaticPlan { /* private fields */ }
Expand description

A zero-allocation view of the built-in registration tree. 内置注册树的零分配视图。

Implementations§

Source§

impl StaticPlan

Source

pub const fn with_grafts( faces: &'static [StaticFace], grafts: &'static [StaticGraftCut], ) -> StaticPlan

Build a release plan whose graft selectors are stored in read-only data. 构造把 graft selector 直接保存在只读数据中的发布计划。

Source

pub const fn faces(self) -> &'static [StaticFace]

The built-in faces in registry-tree order, so a parent precedes its children. 按注册树顺序排列的内置注册面,父级先于子级。

Source

pub const fn grafts(self) -> &'static [StaticGraftCut]

Host-declared grafts captured by the build step without allocation. 构建阶段捕获、无需分配即可读取的宿主 graft 声明。

Source

pub const fn len(self) -> usize

How many faces the plan carries. 该计划携带的注册面数量。

Source

pub const fn is_empty(self) -> bool

Whether the plan carries no faces. 该计划是否不携带任何注册面。

Source

pub fn find(self, id: NodeId) -> Option<&'static StaticFace>

Find a face by identity. 按身份查找注册面。

The generated table is emitted in registry-tree traversal order, because registrations() and everything that registers from it rely on parents coming first. It is therefore not sorted by identity, and a binary search over it silently missed faces — two of the three faces in the example plan. The scan is linear, and the table stays in the order its other consumers need. 生成的表按注册树遍历顺序发射,因为 registrations() 以及所有据此注册的代码都 依赖父级先出现。它因此不是按身份排序的,对它做二分会让注册面被静默漏掉—— 示例计划里三个面漏了两个。这里改为线性扫描,表则保持其他消费方需要的顺序。

Source

pub fn children_of( self, parent: NodeId, ) -> impl Iterator<Item = &'static StaticFace>

The faces whose parent is parent, in table order. 父级为 parent 的注册面,按表顺序。

The table is emitted in traversal order, not identity order, so this is a linear filter rather than a range lookup. 该表按遍历顺序而非身份顺序发射,因此这里用线性过滤而不是区间查找。

Trait Implementations§

Source§

impl Clone for StaticPlan

Source§

fn clone(&self) -> StaticPlan

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 Copy for StaticPlan

Source§

impl Debug for StaticPlan

Source§

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

Formats the value using the given formatter. Read more

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.