pub struct NodeId(/* private fields */);Expand description
Stable source identity shared by registration, diagnostics, and pruning. 注册、诊断和修剪共用的稳定源码身份。
This is a compact 128-bit prefix of SHA-256 for indexing and diagnostics, not a cryptographic signature. Plugin trust must use the full digest and a signature verifier. 这是用于索引和诊断的 SHA-256 128 位短标识,不是密码学签名。插件信任必须 使用完整摘要和签名验证器。
Implementations§
Source§impl NodeId
impl NodeId
Sourcepub const fn from_path(relative_path: &str, declared_name: &str) -> NodeId
pub const fn from_path(relative_path: &str, declared_name: &str) -> NodeId
Hash relative_path + 0x00 + declared_name during constant evaluation.
在常量求值期间散列“相对路径 + 0x00 + 声明名”。
Both slices are separator-folded here; from_namespaced_path explains why
the namespaced entry point folds only its first two components.
这里两个切片都会折叠分隔符;命名空间入口为何只折叠前两个组成部分,见
from_namespaced_path。
Sourcepub const fn from_namespaced_path(
namespace: &str,
relative_path: &str,
declared_name: &str,
) -> NodeId
pub const fn from_namespaced_path( namespace: &str, relative_path: &str, declared_name: &str, ) -> NodeId
Hash a declaration together with the package namespace that owns it. 将声明与拥有它的包命名空间一起散列,避免不同库的相对路径串库。
Sourcepub const fn from_bytes(input: &[u8]) -> NodeId
pub const fn from_bytes(input: &[u8]) -> NodeId
Hash one byte slice; primarily useful for standard-vector tests. 散列单个字节切片,主要用于标准向量测试。
Sourcepub const fn into_bytes(self) -> [u8; 16]
pub const fn into_bytes(self) -> [u8; 16]
The raw 128-bit identity, round-trippable through from_raw at build time.
原始 128 位身份,构建期可经 from_raw 还原。
Sourcepub const fn pruning_table(self) -> [u64; 4096]
pub const fn pruning_table(self) -> [u64; 4096]
Produce a node-specific compile-time payload for pruning verification. 为修剪验证生成节点专属的编译期负载。
The table is emitted only when the owning node’s probe is reached. 只有触达所属节点探针时,这张表才会进入最终产物。
Trait Implementations§
impl Copy for NodeId
impl Eq for NodeId
Source§impl Ord for NodeId
impl Ord for NodeId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for NodeId
impl PartialOrd for NodeId
impl StructuralPartialEq for NodeId
Auto Trait Implementations§
impl Freeze for NodeId
impl RefUnwindSafe for NodeId
impl Send for NodeId
impl Sync for NodeId
impl Unpin for NodeId
impl UnsafeUnpin for NodeId
impl UnwindSafe for NodeId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.