pub struct HashValue { /* private fields */ }Expand description
This is a part of the HashHeader. The HashValue-struct contains the appropriate hash algorithm and the hash. This struct has a version also.
Implementations
sourceimpl HashValue
impl HashValue
sourcepub fn new(
version: u8,
hash_type: HashType,
hash: Vec<u8>,
ed25519_signature: Option<[u8; 64]>
) -> HashValue
pub fn new(
version: u8,
hash_type: HashType,
hash: Vec<u8>,
ed25519_signature: Option<[u8; 64]>
) -> HashValue
creates a new HashValue for the given parameters.
sourcepub fn new_empty(structure_version: u8, hash_type: HashType) -> HashValue
pub fn new_empty(structure_version: u8, hash_type: HashType) -> HashValue
creates a new, empty HashValue for a given hashtype.
sourcepub fn set_ed25519_signature(&mut self, signature: [u8; 64])
pub fn set_ed25519_signature(&mut self, signature: [u8; 64])
sets the appropriate ed25519 signature
Trait Implementations
sourceimpl HeaderCoding for HashValue
impl HeaderCoding for HashValue
sourcefn identifier() -> u32
fn identifier() -> u32
returns the identifier (=Magic bytes) of the header.
sourcefn encode_header(&self) -> Vec<u8>
fn encode_header(&self) -> Vec<u8>
encodes the header.
sourcefn header_size(&self) -> usize
fn header_size(&self) -> usize
returns the size of the encoded header (in bytes)
sourcefn encode_directly(&self) -> Vec<u8>
fn encode_directly(&self) -> Vec<u8>
encodes the (header) value/object directly (= without key).
sourcefn encode_for_key<K: Into<String>>(&self, key: K) -> Vec<u8>
fn encode_for_key<K: Into<String>>(&self, key: K) -> Vec<u8>
encodes a key to the (header) value/object.
sourcefn decode_header_length<R: Read>(data: &mut R) -> Result<u64>
fn decode_header_length<R: Read>(data: &mut R) -> Result<u64>
decodes the length of the header.
sourcefn check_identifier<R: Read>(data: &mut R) -> bool
fn check_identifier<R: Read>(data: &mut R) -> bool
checks if the read identifier is valid for this header.
impl Eq for HashValue
impl StructuralEq for HashValue
impl StructuralPartialEq for HashValue
Auto Trait Implementations
impl RefUnwindSafe for HashValue
impl Send for HashValue
impl Sync for HashValue
impl Unpin for HashValue
impl UnwindSafe for HashValue
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more