pub struct H256(/* private fields */);Expand description
Represent 256 bits
Implementations§
Source§impl H256
impl H256
pub const fn zero() -> Self
pub fn is_zero(&self) -> bool
pub fn get_bit(&self, i: u8) -> bool
pub fn set_bit(&mut self, i: u8)
pub fn clear_bit(&mut self, i: u8)
pub fn as_slice(&self) -> &[u8] ⓘ
Sourcepub fn fork_height(&self, key: &H256) -> u8
pub fn fork_height(&self, key: &H256) -> u8
Treat H256 as a path in a tree fork height is the number of common bits(from heigher to lower: 255..=0) of two H256
Sourcepub fn parent_path(&self, height: u8) -> Self
pub fn parent_path(&self, height: u8) -> Self
Treat H256 as a path in a tree return parent_path of self
Sourcepub fn copy_bits(&self, range: impl RangeBounds<u8>) -> Self
pub fn copy_bits(&self, range: impl RangeBounds<u8>) -> Self
Copy bits and return a new H256
Trait Implementations§
Source§impl BorshDeserialize for H256
impl BorshDeserialize for H256
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for H256
impl BorshSerialize for H256
Source§impl Ord for H256
impl Ord for H256
Source§impl PartialOrd for H256
impl PartialOrd for H256
impl Copy for H256
impl Eq for H256
impl StructuralPartialEq for H256
Auto Trait Implementations§
impl Freeze for H256
impl RefUnwindSafe for H256
impl Send for H256
impl Sync for H256
impl Unpin for H256
impl UnwindSafe for H256
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