Struct microkelvin::Branch
source · [−]pub struct Branch<'a, C, A, I>(_)
where
C: Archive;
Expand description
Reprents an immutable branch view into a collection.
Branche are always guaranteed to point at a leaf, and can be dereferenced to the pointed-at leaf.
Implementations
sourceimpl<'a, C, A, I> Branch<'a, C, A, I> where
C: Archive + Compound<A, I>,
C::Archived: ArchivedCompound<C, A, I>,
C::Leaf: Archive,
impl<'a, C, A, I> Branch<'a, C, A, I> where
C: Archive + Compound<A, I>,
C::Archived: ArchivedCompound<C, A, I>,
C::Leaf: Archive,
sourcepub fn map_leaf<M>(
self,
closure: fn(_: MaybeArchived<'a, C::Leaf>) -> M
) -> MappedBranch<'a, C, A, I, M> where
C: Compound<A, I>,
M: 'a,
pub fn map_leaf<M>(
self,
closure: fn(_: MaybeArchived<'a, C::Leaf>) -> M
) -> MappedBranch<'a, C, A, I, M> where
C: Compound<A, I>,
M: 'a,
Returns a branch that maps the leaf to a specific value. Used in maps for example, to get easy access to the value of the KV-pair
sourcepub fn leaf(&self) -> MaybeArchived<'_, C::Leaf>
pub fn leaf(&self) -> MaybeArchived<'_, C::Leaf>
Returns a reference to the currently pointed-at leaf
sourcepub fn walk<W>(root: MaybeArchived<'a, C>, walker: W) -> Option<Self> where
C: Compound<A, I>,
C::Archived: ArchivedCompound<C, A, I> + for<'any> CheckBytes<DefaultValidator<'any>>,
C::Leaf: 'a + Archive,
A: Annotation<C::Leaf>,
W: Walker<C, A, I>,
pub fn walk<W>(root: MaybeArchived<'a, C>, walker: W) -> Option<Self> where
C: Compound<A, I>,
C::Archived: ArchivedCompound<C, A, I> + for<'any> CheckBytes<DefaultValidator<'any>>,
C::Leaf: 'a + Archive,
A: Annotation<C::Leaf>,
W: Walker<C, A, I>,
Performs a tree walk, returning either a valid branch or None if the walk failed.
sourcepub fn walk_with_store<W>(
root: MaybeArchived<'a, C>,
walker: W,
store: StoreRef<I>
) -> Option<Self> where
C: Compound<A, I>,
C::Archived: ArchivedCompound<C, A, I> + for<'any> CheckBytes<DefaultValidator<'any>>,
C::Leaf: 'a + Archive,
A: Annotation<C::Leaf>,
W: Walker<C, A, I>,
pub fn walk_with_store<W>(
root: MaybeArchived<'a, C>,
walker: W,
store: StoreRef<I>
) -> Option<Self> where
C: Compound<A, I>,
C::Archived: ArchivedCompound<C, A, I> + for<'any> CheckBytes<DefaultValidator<'any>>,
C::Leaf: 'a + Archive,
A: Annotation<C::Leaf>,
W: Walker<C, A, I>,
Performs a tree walk, returning either a valid branch or None if the walk failed.
Trait Implementations
sourceimpl<'a, C, A, I> IntoIterator for Branch<'a, C, A, I> where
C: Compound<A, I>,
C::Archived: ArchivedCompound<C, A, I> + for<'any> CheckBytes<DefaultValidator<'any>>,
C::Leaf: 'a + Archive,
A: Annotation<C::Leaf>,
impl<'a, C, A, I> IntoIterator for Branch<'a, C, A, I> where
C: Compound<A, I>,
C::Archived: ArchivedCompound<C, A, I> + for<'any> CheckBytes<DefaultValidator<'any>>,
C::Leaf: 'a + Archive,
A: Annotation<C::Leaf>,
Auto Trait Implementations
impl<'a, C, A, I> !RefUnwindSafe for Branch<'a, C, A, I>
impl<'a, C, A, I> !Send for Branch<'a, C, A, I>
impl<'a, C, A, I> !Sync for Branch<'a, C, A, I>
impl<'a, C, A, I> Unpin for Branch<'a, C, A, I> where
A: Unpin,
I: Unpin,
impl<'a, C, A, I> !UnwindSafe for Branch<'a, C, A, I>
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more