pub struct BlockHash(/* private fields */);Expand description
A block’s content address: the 32-byte SHA-256 of its chained identity.
Implementations§
Source§impl BlockHash
impl BlockHash
pub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn as_bytes(&self) -> &[u8; 32]
Sourcepub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
Lowercase hex, 64 characters. This is the on-disk file name the SSD tier will use.
Sourcepub fn shard_prefix(&self, n: usize) -> String
pub fn shard_prefix(&self, n: usize) -> String
The first n hex characters, for sharding blocks into
subdirectories so one directory never holds every block on the
machine. n is clamped to the digest length.
Trait Implementations§
impl Copy for BlockHash
impl Eq for BlockHash
Source§impl Ord for BlockHash
impl Ord for BlockHash
1.21.0 (const: unstable) · 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 PartialOrd for BlockHash
impl PartialOrd for BlockHash
impl StructuralPartialEq for BlockHash
Auto Trait Implementations§
impl Freeze for BlockHash
impl RefUnwindSafe for BlockHash
impl Send for BlockHash
impl Sync for BlockHash
impl Unpin for BlockHash
impl UnsafeUnpin for BlockHash
impl UnwindSafe for BlockHash
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§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> ⓘ
Converts
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> ⓘ
Converts
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