pub struct SlotPath(pub SmallVec<[Key; 8]>);Expand description
Path from the root cnode through nested cnodes to a slot.
The sequence of Keys walked through nested Cap::CNode slots; the
final key is the target. An empty path is invalid (must address some
slot). Backed by a [SmallVec] sized to MAX_SOURCE_DEPTH so a typical
(shallow) path stays inline; the SSZ wire/hash form is identical to
Vec<Key> (forwarded via #[ssz(transparent)]).
Example: SlotPath::root(Key::from(7)) addresses slot 7 of the root
cnode; a two-step path addresses a slot of the Cap::CNode held in the
first step’s slot.
Tuple Fields§
§0: SmallVec<[Key; 8]>Implementations§
Source§impl SlotPath
impl SlotPath
Sourcepub fn new(steps: impl IntoIterator<Item = Key>) -> Result<Self, CapError>
pub fn new(steps: impl IntoIterator<Item = Key>) -> Result<Self, CapError>
Construct from a list of steps. Returns Err if empty.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True iff this path has no steps. A well-formed path is never empty;
this exists for the clippy::len_without_is_empty lint and decode
guards.
Sourcepub fn is_root_slot(&self) -> bool
pub fn is_root_slot(&self) -> bool
True iff this path addresses a slot in the root cnode (one step).
Trait Implementations§
Source§impl Archive for SlotPath
impl Archive for SlotPath
Source§const COPY_OPTIMIZATION: CopyOptimization<Self>
const COPY_OPTIMIZATION: CopyOptimization<Self>
serialize. Read moreSource§type Archived = ArchivedSlotPath
type Archived = ArchivedSlotPath
Source§type Resolver = SlotPathResolver
type Resolver = SlotPathResolver
Source§impl Decode for SlotPath
impl Decode for SlotPath
Source§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true iff this type is fixed-length.Source§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
BYTES_PER_LENGTH_OFFSET].Source§fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
bytes, rejecting trailing input.Source§impl Encode for SlotPath
impl Encode for SlotPath
Source§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true iff this type is fixed-length (no variable-length fields).Source§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
BYTES_PER_LENGTH_OFFSET] (i.e. the size of the offset slot).Source§fn is_basic_type() -> bool
fn is_basic_type() -> bool
true for “basic” SSZ types (uintN, bool), which pack adjacent
elements into shared 32-byte chunks for merkleization. Composite
types (containers, lists, structs) return false (the default).Source§fn ssz_bytes_len(&self) -> usize
fn ssz_bytes_len(&self) -> usize
self when serialized.Source§fn ssz_append(&self, buf: &mut Vec<u8>)
fn ssz_append(&self, buf: &mut Vec<u8>)
self to buf.§fn as_ssz_bytes(&self) -> Vec<u8> ⓘ
fn as_ssz_bytes(&self) -> Vec<u8> ⓘ
Vec<u8> allocated through the global allocator.impl Eq for SlotPath
impl StructuralPartialEq for SlotPath
Auto Trait Implementations§
impl Freeze for SlotPath
impl RefUnwindSafe for SlotPath
impl Send for SlotPath
impl Sync for SlotPath
impl Unpin for SlotPath
impl UnsafeUnpin for SlotPath
impl UnwindSafe for SlotPath
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read more