Enum microkelvin::Link
source · [−]pub enum Link<C, A, I> {
Memory {
rc: Rc<C>,
annotation: RefCell<Option<A>>,
},
Stored {
stored: Stored<C, I>,
a: A,
},
}
Expand description
The Link struct is an annotated merkle link to a compound type
The link takes care of lazily evaluating the annotation of the inner type, and to load it from memory or backend when needed.
Variants
Memory
A Link to a node in memory
Stored
A Link to a stored node
Implementations
sourceimpl<C, A, I> Link<C, A, I>
impl<C, A, I> Link<C, A, I>
sourcepub fn annotation(&self) -> ARef<'_, A> where
C: Compound<A, I>,
C::Leaf: Archive,
A: Annotation<C::Leaf>,
pub fn annotation(&self) -> ARef<'_, A> where
C: Compound<A, I>,
C::Leaf: Archive,
A: Annotation<C::Leaf>,
Returns a reference to to the annotation stored
sourcepub fn unlink(self) -> C where
C: Compound<A, I> + Clone,
C::Archived: Deserialize<C, StoreRef<I>> + for<'a> CheckBytes<DefaultValidator<'a>>,
pub fn unlink(self) -> C where
C: Compound<A, I> + Clone,
C::Archived: Deserialize<C, StoreRef<I>> + for<'a> CheckBytes<DefaultValidator<'a>>,
Unwraps the underlying value, clones or deserializes it
sourcepub fn inner<'a>(&'a self) -> MaybeStored<'a, C, I> where
C: Archive,
pub fn inner<'a>(&'a self) -> MaybeStored<'a, C, I> where
C: Archive,
Returns a reference to the inner node, possibly in its stored form
sourcepub fn inner_mut(&mut self) -> &mut C where
C: Archive + Clone,
C::Archived: Deserialize<C, StoreRef<I>> + for<'a> CheckBytes<DefaultValidator<'a>>,
pub fn inner_mut(&mut self) -> &mut C where
C: Archive + Clone,
C::Archived: Deserialize<C, StoreRef<I>> + for<'a> CheckBytes<DefaultValidator<'a>>,
Returns a Mutable reference to the underlying compound node
Drops cached annotations and ids
Trait Implementations
sourceimpl<C, A, I> Archive for Link<C, A, I>
impl<C, A, I> Archive for Link<C, A, I>
sourceimpl<C, A, I, D> Deserialize<Link<C, A, I>, D> for ArchivedLink<C, A, I> where
A: Clone,
I: Clone,
D: StoreProvider<I>,
impl<C, A, I, D> Deserialize<Link<C, A, I>, D> for ArchivedLink<C, A, I> where
A: Clone,
I: Clone,
D: StoreProvider<I>,
sourceimpl<C, A, I, S> Serialize<S> for Link<C, A, I> where
C: Compound<A, I> + Serialize<S> + Serialize<StoreSerializer<I>>,
A: Clone + Annotation<C::Leaf>,
I: Clone,
S: BorrowMut<StoreSerializer<I>> + Fallible,
impl<C, A, I, S> Serialize<S> for Link<C, A, I> where
C: Compound<A, I> + Serialize<S> + Serialize<StoreSerializer<I>>,
A: Clone + Annotation<C::Leaf>,
I: Clone,
S: BorrowMut<StoreSerializer<I>> + Fallible,
Auto Trait Implementations
impl<C, A, I> !RefUnwindSafe for Link<C, A, I>
impl<C, A, I> !Send for Link<C, A, I>
impl<C, A, I> !Sync for Link<C, A, I>
impl<C, A, I> Unpin for Link<C, A, I> where
A: Unpin,
C: Unpin,
I: Unpin,
impl<C, A, I> !UnwindSafe for Link<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> ArchiveUnsized for T where
T: Archive,
impl<T> ArchiveUnsized for T where
T: Archive,
type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
The archived counterpart of this type. Unlike Archive
, it may be unsized. Read more
type MetadataResolver = ()
type MetadataResolver = ()
The resolver for the metadata of this type. Read more
sourceunsafe fn resolve_metadata(
&self,
usize,
<T as ArchiveUnsized>::MetadataResolver,
*mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
)
unsafe fn resolve_metadata(
&self,
usize,
<T as ArchiveUnsized>::MetadataResolver,
*mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
)
Creates the archived version of the metadata for this value at the given position and writes it to the given output. Read more
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
sourceimpl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
sourceimpl<T, S> SerializeUnsized<S> for T where
T: Serialize<S>,
S: Serializer + ?Sized,
impl<T, S> SerializeUnsized<S> for T where
T: Serialize<S>,
S: Serializer + ?Sized,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more