Struct Hasher

Source
pub struct Hasher<T, const LENGTH: usize>(/* private fields */)
where
    T: Hashing<LENGTH>;
Expand description

The hasher type

Trait Implementations§

Source§

impl<T, const LENGTH: usize> AsRef<[u8]> for Hasher<T, LENGTH>
where T: Hashing<LENGTH>,

Source§

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

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

impl<T, const LENGTH: usize> Clone for Hasher<T, LENGTH>
where T: Hashing<LENGTH> + Clone,

Source§

fn clone(&self) -> Hasher<T, LENGTH>

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<T, const LENGTH: usize> Debug for Hasher<T, LENGTH>
where T: Hashing<LENGTH> + Debug,

Source§

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

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

impl<T, const LENGTH: usize> Default for Hasher<T, LENGTH>
where T: Hashing<LENGTH>,

Source§

fn default() -> Self

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

impl<'de, T, const LENGTH: usize> Deserialize<'de> for Hasher<T, LENGTH>
where T: Hashing<LENGTH> + Deserialize<'de>,

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<T, const LENGTH: usize> From<[u8; LENGTH]> for Hasher<T, LENGTH>
where T: Hashing<LENGTH>,

Source§

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

Converts to this type from the input type.
Source§

impl From<Hasher<DoubleSha256Hashing, SHA256_LENGTH>> for Uint256

Source§

fn from(value: DoubleSha256Hasher) -> Self

Converts to this type from the input type.
Source§

impl<T, const LENGTH: usize> Hashing<LENGTH> for Hasher<T, LENGTH>
where T: Hashing<LENGTH>,

Source§

fn hash(data: &[u8]) -> Self

Hash the given data
Source§

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

Get the bytes of the hash
Source§

fn from_bytes(bytes: &[u8]) -> StacksResult<Self>

Attempt to create a hash from the given bytes
Source§

fn new(value: impl AsRef<[u8]>) -> Self

Create a hash from the given bytes
Source§

fn zeroes() -> Self

Create a zeroed hash
Source§

fn checksum(&self) -> [u8; 4]

Get the checksum of the hash
Source§

fn from_hex(data: impl AsRef<str>) -> StacksResult<Self>

Attempt to create a hash from the given hex bytes
Source§

fn to_hex(&self) -> String

Get the hex representation of the hash
Source§

impl<T, const LENGTH: usize> Ord for Hasher<T, LENGTH>
where T: Hashing<LENGTH> + Ord,

Source§

fn cmp(&self, other: &Hasher<T, LENGTH>) -> 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<T, const LENGTH: usize> PartialEq for Hasher<T, LENGTH>
where T: Hashing<LENGTH> + PartialEq,

Source§

fn eq(&self, other: &Hasher<T, LENGTH>) -> 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<T, const LENGTH: usize> PartialOrd for Hasher<T, LENGTH>
where T: Hashing<LENGTH> + PartialOrd,

Source§

fn partial_cmp(&self, other: &Hasher<T, LENGTH>) -> 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<T, const LENGTH: usize> Serialize for Hasher<T, LENGTH>
where T: Hashing<LENGTH> + Serialize,

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<T, const LENGTH: usize> TryFrom<&[u8]> for Hasher<T, LENGTH>
where T: Hashing<LENGTH>,

Source§

type Error = StacksError

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

fn try_from(value: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<T, const LENGTH: usize> Copy for Hasher<T, LENGTH>
where T: Hashing<LENGTH> + Copy,

Source§

impl<T, const LENGTH: usize> Eq for Hasher<T, LENGTH>
where T: Hashing<LENGTH> + Eq,

Source§

impl<T, const LENGTH: usize> StructuralPartialEq for Hasher<T, LENGTH>
where T: Hashing<LENGTH>,

Auto Trait Implementations§

§

impl<T, const LENGTH: usize> Freeze for Hasher<T, LENGTH>
where T: Freeze,

§

impl<T, const LENGTH: usize> RefUnwindSafe for Hasher<T, LENGTH>
where T: RefUnwindSafe,

§

impl<T, const LENGTH: usize> Send for Hasher<T, LENGTH>
where T: Send,

§

impl<T, const LENGTH: usize> Sync for Hasher<T, LENGTH>
where T: Sync,

§

impl<T, const LENGTH: usize> Unpin for Hasher<T, LENGTH>
where T: Unpin,

§

impl<T, const LENGTH: usize> UnwindSafe for Hasher<T, LENGTH>
where T: UnwindSafe,

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> Base32Len for T
where T: AsRef<[u8]>,

Source§

fn base32_len(&self) -> usize

Calculate the base32 serialized length
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> CheckBase32<Vec<u5>> for T
where T: AsRef<[u8]>,

Source§

type Err = Error

Error type if conversion fails
Source§

fn check_base32(self) -> Result<Vec<u5>, <T as CheckBase32<Vec<u5>>>::Err>

Check if all values are in range and return array-like struct of u5 values
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<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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>
where W: WriteBase32,

Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate.
Source§

fn to_base32(&self) -> Vec<u5>

Convert Self to base32 vector
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, 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>,