Struct nmt_rs::NamespacedHash
source · 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 copy 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)