HashBytes

Struct HashBytes 

Source
#[repr(transparent)]
pub struct HashBytes(pub [u8; 32]);
Expand description

Type alias for a cell hash.

Tuple Fields§

§0: [u8; 32]

Implementations§

Source§

impl HashBytes

Source

pub const ZERO: Self

Array of zero bytes.

Source

pub fn from_slice(slice: &[u8]) -> Self

Converts slice to a hash bytes.

§Panics

Panics if the length of the slice is not 32 bytes.

Source

pub const fn wrap(value: &[u8; 32]) -> &Self

Wraps a reference to an internal array into a newtype reference.

Source

pub const fn as_slice(&self) -> &[u8]

Returns a slice containing the entire array.

Source

pub fn as_mut_slice(&mut self) -> &mut [u8]

Returns a mutable slice containing the entire array.

Source

pub const fn as_array(&self) -> &[u8; 32]

Returns an internal array.

Source

pub fn as_mut_array(&mut self) -> &mut [u8; 32]

Returns a mutable internal array.

Source

pub const fn as_ptr(&self) -> *const u8

Returns a raw pointer to the slice’s buffer.

Source

pub const fn first_chunk(&self) -> &[u8; 8]

Returns a first chunk of 8 bytes.

Trait Implementations§

Source§

impl AsMut<[u8]> for HashBytes

Source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsMut<[u8; 32]> for HashBytes

Source§

fn as_mut(&mut self) -> &mut [u8; 32]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<[u8]> for HashBytes

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<[u8; 32]> for HashBytes

Source§

fn as_ref(&self) -> &[u8; 32]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<[u8]> for HashBytes

Source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
Source§

impl Borrow<HashBytes> for [u8; 32]

Source§

fn borrow(&self) -> &HashBytes

Immutably borrows from an owned value. Read more
Source§

impl BorrowMut<[u8]> for HashBytes

Source§

fn borrow_mut(&mut self) -> &mut [u8]

Mutably borrows from an owned value. Read more
Source§

impl Clone for HashBytes

Source§

fn clone(&self) -> HashBytes

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HashBytes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HashBytes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for HashBytes

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl DictKey for HashBytes

Source§

const BITS: u16 = 256u16

Length in bits for a dictionary key.
Source§

fn from_raw_data(d: &[u8; 128]) -> Option<Self>

Creates a key from a raw builder data.
Source§

impl Display for HashBytes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<[u8; 32]> for HashBytes

Source§

fn from(value: [u8; 32]) -> Self

Converts to this type from the input type.
Source§

impl From<GenericArray<u8, <CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>> as OutputSizeUser>::OutputSize>> for HashBytes

Source§

fn from(value: Output<Sha256>) -> Self

Converts to this type from the input type.
Source§

impl From<HashBytes> for [u8; 32]

Source§

fn from(value: HashBytes) -> Self

Converts to this type from the input type.
Source§

impl FromAbi for HashBytes

Source§

fn from_abi(value: AbiValue) -> Result<Self>

Constructs self from the ABI value.
Source§

impl FromPlainAbi for HashBytes

Source§

fn from_plain_abi(value: PlainAbiValue) -> Result<Self>

Constructs self from the plain ABI value.
Source§

impl FromStr for HashBytes

Source§

type Err = ParseHashBytesError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for HashBytes

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<I> Index<I> for HashBytes
where [u8; 32]: Index<I>,

Source§

type Output = <[u8; 32] as Index<I>>::Output

The returned type after indexing.
Source§

fn index(&self, index: I) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<I> IndexMut<I> for HashBytes
where [u8; 32]: IndexMut<I>,

Source§

fn index_mut(&mut self, index: I) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl IntoAbi for HashBytes

Source§

fn as_abi(&self) -> AbiValue

Returns a corresponding ABI value. Read more
Source§

fn into_abi(self) -> AbiValue
where Self: Sized,

Converts into a corresponding ABI value.
Source§

impl IntoPlainAbi for HashBytes

Source§

fn as_plain_abi(&self) -> PlainAbiValue

Returns a corresponding plain ABI value. Read more
Source§

fn into_plain_abi(self) -> PlainAbiValue
where Self: Sized,

Converts into a corresponding plain ABI value.
Source§

impl Load<'_> for HashBytes

Source§

fn load_from(s: &mut CellSlice<'_>) -> Result<Self, Error>

Tries to load itself from a cell slice.
Source§

impl Ord for HashBytes

Source§

fn cmp(&self, other: &HashBytes) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<[u8]> for HashBytes

Source§

fn eq(&self, other: &[u8]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<[u8; 32]> for HashBytes

Source§

fn eq(&self, other: &[u8; 32]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<HashBytes> for [u8]

Source§

fn eq(&self, other: &HashBytes) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<HashBytes> for [u8; 32]

Source§

fn eq(&self, other: &HashBytes) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for HashBytes

Source§

fn eq(&self, other: &HashBytes) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for HashBytes

Source§

fn partial_cmp(&self, other: &HashBytes) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for HashBytes

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Store for HashBytes

Source§

fn store_into( &self, b: &mut CellBuilder, _: &mut dyn CellContext, ) -> Result<(), Error>

Tries to store itself into the cell builder.
Source§

impl WithAbiType for HashBytes

Source§

fn abi_type() -> AbiType

Returns a corresponding ABI type.
Source§

impl WithPlainAbiType for HashBytes

Source§

fn plain_abi_type() -> PlainAbiType

Returns a corresponding plain ABI type.
Source§

impl Copy for HashBytes

Source§

impl Eq for HashBytes

Source§

impl StructuralPartialEq for HashBytes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compares self to key and returns their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compares self to key and returns true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToHex for T
where T: AsRef<[u8]>,

Source§

fn encode_hex<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
Source§

fn encode_hex_upper<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> EquivalentRepr<T> for T

Source§

impl<T> NumBytes for T
where T: Debug + AsRef<[u8]> + AsMut<[u8]> + PartialEq + Eq + PartialOrd + Ord + Hash + Borrow<[u8]> + BorrowMut<[u8]> + ?Sized,