pub struct MerkleTreeState<'a, E>where
E: Environment,{ /* private fields */ }Expand description
The contents of a MerkleTree, sans its hashers.
This is the serializable form of a Merkle tree, intended for caching one on
disk. Note that a MerkleTree itself is deliberately not serializable:
its hashers hold precomputed bases (tens of MiBs of group elements for the
BHP hashers), and deserializing those is orders of magnitude more expensive
than setting them up from scratch - each group element costs a subgroup check,
i.e. a full scalar multiplication.
Implementations§
Source§impl<E> MerkleTreeState<'_, E>where
E: Environment,
impl<E> MerkleTreeState<'_, E>where
E: Environment,
Sourcepub fn into_owned(self) -> MerkleTreeState<'static, E>
pub fn into_owned(self) -> MerkleTreeState<'static, E>
Converts the state into one that borrows nothing, cloning the tree’s nodes if needed.
This is what allows a state taken from a MerkleTree behind a lock to be used after the
lock is released - most importantly, to be serialized without holding it for the duration of
the write. It is a no-op for a state that already owns its nodes, such as a deserialized one.
Trait Implementations§
Source§impl<'a, E> Clone for MerkleTreeState<'a, E>where
E: Clone + Environment,
impl<'a, E> Clone for MerkleTreeState<'a, E>where
E: Clone + Environment,
Source§fn clone(&self) -> MerkleTreeState<'a, E>
fn clone(&self) -> MerkleTreeState<'a, E>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a, E> Debug for MerkleTreeState<'a, E>where
E: Debug + Environment,
impl<'a, E> Debug for MerkleTreeState<'a, E>where
E: Debug + Environment,
Source§impl<'de, 'a, E> Deserialize<'de> for MerkleTreeState<'a, E>
impl<'de, 'a, E> Deserialize<'de> for MerkleTreeState<'a, E>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MerkleTreeState<'a, E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MerkleTreeState<'a, E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<'a, E> Serialize for MerkleTreeState<'a, E>
impl<'a, E> Serialize for MerkleTreeState<'a, E>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl<'a, E> Freeze for MerkleTreeState<'a, E>
impl<'a, E> RefUnwindSafe for MerkleTreeState<'a, E>
impl<'a, E> Send for MerkleTreeState<'a, E>
impl<'a, E> Sync for MerkleTreeState<'a, E>
impl<'a, E> Unpin for MerkleTreeState<'a, E>
impl<'a, E> UnsafeUnpin for MerkleTreeState<'a, E>
impl<'a, E> UnwindSafe for MerkleTreeState<'a, E>
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<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more