Struct primitive_types::H256 [−][src]
Expand description
Fixed-size uninterpreted hash type with 32 bytes (256 bits) size.
Implementations
Returns a new fixed hash where all bits are set to the given byte.
Extracts a mutable byte slice containing the entire fixed hash.
Extracts a reference to the byte array containing the entire fixed hash.
Extracts a reference to the byte array containing the entire fixed hash.
Returns the inner bytes array.
Returns a mutable raw pointer to the value.
Utilities using the byteorder
crate.
Returns the lowest 8 bytes interpreted as big-endian.
Note
For hash type with less than 8 bytes the missing bytes are interpreted as being zero.
Returns the lowest 8 bytes interpreted as little-endian.
Note
For hash type with less than 8 bytes the missing bytes are interpreted as being zero.
Returns the lowest 8 bytes interpreted as native-endian.
Note
For hash type with less than 8 bytes the missing bytes are interpreted as being zero.
Creates a new hash type from the given u64
value.
Note
- The given
u64
value is interpreted as big endian. - Ignores the most significant bits of the given value if the hash type has less than 8 bytes.
Creates a new hash type from the given u64
value.
Note
- The given
u64
value is interpreted as little endian. - Ignores the most significant bits of the given value if the hash type has less than 8 bytes.
Creates a new hash type from the given u64
value.
Note
- The given
u64
value is interpreted as native endian. - Ignores the most significant bits of the given value if the hash type has less than 8 bytes.
Utilities using the rand
crate.
Assign self
to a cryptographically random value using the
given random number generator.
Create a new hash with cryptographically random content using the given random number generator.
Trait Implementations
Performs the &=
operation. Read more
Performs the &=
operation. Read more
Performs the |=
operation. Read more
Performs the |=
operation. Read more
Performs the ^=
operation. Read more
Performs the ^=
operation. Read more
Attempt to deserialise the value from input.
Attempt to skip the encoded value from input. Read more
fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
Generate a random value of T
, using rng
as the source of randomness.
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
Convert self to a slice and then invoke the given closure with it.
Convert self to a slice and append it to the destination.
fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
type Err = FromHexError
type Err = FromHexError
The associated error which can be returned from parsing.
Upper bound, in bytes, of the maximum encoded size of this item.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for H256
impl UnwindSafe for H256
Blanket Implementations
pub fn as_byte_slice(&self) -> &[u8]
pub fn as_mut_byte_slice(&mut self) -> &mut [u8]
pub fn as_mut_slice_of<T>(&mut self) -> Result<&mut [T], Error> where
T: FromByteSlice,
pub fn as_slice_of<T>(&self) -> Result<&[T], Error> where
T: FromByteSlice,
Mutably borrows from an owned value. Read more
impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
T: Encode,
impl<'_, T> EncodeLike<&'_ T> for T where
T: Encode,
impl<'_, T> EncodeLike<&'_ mut T> for T where
T: Encode,
impl<T> EncodeLike<Arc<T>> for T where
T: Encode,
impl<T> EncodeLike<Rc<T>> for T where
T: Encode,