pub struct Slice32(_);
Expand description
Wrapper type for all slice-based 256-bit types implementing many important traits, so types based on it can simply derive their implementations.
Type keeps data in little-endian byte order and displays them in the same order (like bitcoin SHA256 single hash type).
Implementations
sourceimpl Slice32
impl Slice32
sourcepub fn from_slice(slice: impl AsRef<[u8]>) -> Option<Slice32>
pub fn from_slice(slice: impl AsRef<[u8]>) -> Option<Slice32>
Constructs 256-bit array from a provided slice. If the slice length
is not equal to 32 bytes, returns None
sourcepub fn as_slice(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn as_slice(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Returns byte slice representation.
Trait Implementations
sourceimpl FromHex for Slice32
impl FromHex for Slice32
sourcefn from_byte_iter<I>(iter: I) -> Result<Self, Error> where
I: Iterator<Item = Result<u8, Error>> + ExactSizeIterator + DoubleEndedIterator,
fn from_byte_iter<I>(iter: I) -> Result<Self, Error> where
I: Iterator<Item = Result<u8, Error>> + ExactSizeIterator + DoubleEndedIterator,
Produce an object from a byte iterator
sourceimpl Ord for Slice32
impl Ord for Slice32
sourceimpl PartialOrd<Slice32> for Slice32
impl PartialOrd<Slice32> for Slice32
sourcefn partial_cmp(&self, other: &Slice32) -> Option<Ordering>
fn partial_cmp(&self, other: &Slice32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Wrapper for Slice32
impl Wrapper for Slice32
sourcefn from_inner(inner: Self::Inner) -> Self
fn from_inner(inner: Self::Inner) -> Self
Instantiates wrapper type with the inner data
sourcefn as_inner(&self) -> &Self::Inner
fn as_inner(&self) -> &Self::Inner
Returns reference to the inner representation for the wrapper type
sourcefn as_inner_mut(&mut self) -> &mut Self::Inner
fn as_inner_mut(&mut self) -> &mut Self::Inner
Returns a mutable reference to the inner representation for the wrapper type Read more
sourcefn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Unwraps the wrapper returning the inner type
impl Copy for Slice32
impl Eq for Slice32
impl StructuralEq for Slice32
impl StructuralPartialEq for Slice32
Auto Trait Implementations
impl RefUnwindSafe for Slice32
impl Send for Slice32
impl Sync for Slice32
impl Unpin for Slice32
impl UnwindSafe for Slice32
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