pub struct Digest(/* private fields */);Expand description
Fixed-size hash output.
Used as the prev_hash and hash fields on every crate::Record.
§Example
use audit_trail::Digest;
let zero = Digest::ZERO;
assert_eq!(zero.as_bytes(), &[0u8; 32]);Implementations§
Source§impl Digest
impl Digest
Sourcepub const fn from_bytes(bytes: [u8; 32]) -> Self
pub const fn from_bytes(bytes: [u8; 32]) -> Self
Construct a digest from raw bytes.
§Example
use audit_trail::Digest;
let d = Digest::from_bytes([1u8; 32]);
assert_eq!(d.as_bytes()[0], 1);Sourcepub const fn into_bytes(self) -> [u8; 32]
pub const fn into_bytes(self) -> [u8; 32]
Consume the digest and return the underlying bytes.
Trait Implementations§
impl Copy for Digest
impl Eq for Digest
impl StructuralPartialEq for Digest
Auto Trait Implementations§
impl Freeze for Digest
impl RefUnwindSafe for Digest
impl Send for Digest
impl Sync for Digest
impl Unpin for Digest
impl UnsafeUnpin for Digest
impl UnwindSafe for Digest
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