pub struct NamespacedHash<const NS_ID_SIZE: usize> { /* private fields */ }Expand description
A hash of some data, together with a namespace range
Implementations§
Source§impl<const NS_ID_SIZE: usize> NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> NamespacedHash<NS_ID_SIZE>
Sourcepub const fn new(
min_ns: NamespaceId<NS_ID_SIZE>,
max_ns: NamespaceId<NS_ID_SIZE>,
hash: [u8; 32],
) -> Self
pub const fn new( min_ns: NamespaceId<NS_ID_SIZE>, max_ns: NamespaceId<NS_ID_SIZE>, hash: [u8; 32], ) -> Self
Construct a new namespaced hash from the provided components
Sourcepub fn with_min_and_max_ns(
min_ns: NamespaceId<NS_ID_SIZE>,
max_ns: NamespaceId<NS_ID_SIZE>,
) -> Self
pub fn with_min_and_max_ns( min_ns: NamespaceId<NS_ID_SIZE>, max_ns: NamespaceId<NS_ID_SIZE>, ) -> Self
Construct a namespaced hash with the provided namespace range and the zero hash
Sourcepub fn min_namespace(&self) -> NamespaceId<NS_ID_SIZE>
pub fn min_namespace(&self) -> NamespaceId<NS_ID_SIZE>
Returns the min namespace id of the hash
Sourcepub fn max_namespace(&self) -> NamespaceId<NS_ID_SIZE>
pub fn max_namespace(&self) -> NamespaceId<NS_ID_SIZE>
Returns the max namespace id of the hash
Sourcepub fn contains<M: NamespaceMerkleHasher<NS_ID_SIZE, Output = Self>>(
&self,
namespace: NamespaceId<NS_ID_SIZE>,
) -> bool
pub fn contains<M: NamespaceMerkleHasher<NS_ID_SIZE, Output = Self>>( &self, namespace: NamespaceId<NS_ID_SIZE>, ) -> bool
Check if the given hash includes the provided namespace under the given hasher
Sourcepub fn is_empty_root<M: NamespaceMerkleHasher<NS_ID_SIZE, Output = Self>>(
&self,
) -> bool
pub fn is_empty_root<M: NamespaceMerkleHasher<NS_ID_SIZE, Output = Self>>( &self, ) -> bool
Check if the hash is the empty root under the given hasher
Trait Implementations§
Source§impl<const NS_ID_SIZE: usize> Clone for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> Clone for NamespacedHash<NS_ID_SIZE>
Source§fn clone(&self) -> NamespacedHash<NS_ID_SIZE>
fn clone(&self) -> NamespacedHash<NS_ID_SIZE>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const NS_ID_SIZE: usize> Debug for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> Debug for NamespacedHash<NS_ID_SIZE>
Source§impl<const NS_ID_SIZE: usize> Default for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> Default for NamespacedHash<NS_ID_SIZE>
Source§impl<const NS_ID_SIZE: usize> Hash for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> Hash for NamespacedHash<NS_ID_SIZE>
Source§impl<const NS_ID_SIZE: usize> Ord for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> Ord for NamespacedHash<NS_ID_SIZE>
Source§fn cmp(&self, other: &NamespacedHash<NS_ID_SIZE>) -> Ordering
fn cmp(&self, other: &NamespacedHash<NS_ID_SIZE>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const NS_ID_SIZE: usize> PartialEq for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> PartialEq for NamespacedHash<NS_ID_SIZE>
Source§impl<const NS_ID_SIZE: usize> PartialOrd for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> PartialOrd for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> Eq for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> StructuralPartialEq for NamespacedHash<NS_ID_SIZE>
Auto Trait Implementations§
impl<const NS_ID_SIZE: usize> Freeze for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> RefUnwindSafe for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> Send for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> Sync for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> Unpin for NamespacedHash<NS_ID_SIZE>
impl<const NS_ID_SIZE: usize> UnwindSafe for NamespacedHash<NS_ID_SIZE>
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
Mutably borrows from an owned value. Read more