Struct Hash

Source
pub struct Hash(/* private fields */);
Expand description

A hash; the 32-byte output of a hashing algorithm.

This struct is used most often in solana-sdk and related crates to contain a SHA-256 hash, but may instead contain a blake3 hash, as created by the blake3 module (and used in Message::hash).

Implementationsยง

Sourceยง

impl Hash

Source

pub fn new(hash_slice: &[u8]) -> Hash

Source

pub const fn new_from_array(hash_array: [u8; 32]) -> Hash

Source

pub fn new_unique() -> Hash

unique Hash for tests and benchmarks.

Source

pub fn to_bytes(self) -> [u8; 32]

Trait Implementationsยง

Sourceยง

impl AbiExample for Hash

Sourceยง

impl AsRef<[u8]> for Hash

Sourceยง

fn as_ref(&self) -> &[u8] โ“˜

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

impl BorshDeserialize for Hash

Sourceยง

fn deserialize_reader<__R>(reader: &mut __R) -> Result<Hash, Error>
where __R: Read,

Sourceยง

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>

Deserialize this instance from a slice of bytes.
Sourceยง

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Sourceยง

impl BorshSchema for Hash

Sourceยง

fn declaration() -> String

Get the name of the type without brackets.
Sourceยง

fn add_definitions_recursively(definitions: &mut BTreeMap<String, Definition>)

Recursively, using DFS, add type definitions required for this type. Type definition partially explains how to serialize/deserialize a type.
Sourceยง

impl BorshSerialize for Hash

Sourceยง

fn serialize<__W>(&self, writer: &mut __W) -> Result<(), Error>
where __W: Write,

Sourceยง

impl Clone for Hash

Sourceยง

fn clone(&self) -> Hash

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 Hash

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl Default for Hash

Sourceยง

fn default() -> Hash

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl<'de> Deserialize<'de> for Hash

Sourceยง

fn deserialize<__D>( __deserializer: __D, ) -> Result<Hash, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

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

impl Display for Hash

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl From<[u8; 32]> for Hash

Sourceยง

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

Converts to this type from the input type.
Sourceยง

impl From<Hash> for JsValue

Sourceยง

fn from(value: Hash) -> JsValue

Converts to this type from the input type.
Sourceยง

impl From<Hash> for MessageHash

Sourceยง

fn from(hash: Hash) -> MessageHash

Converts to this type from the input type.
Sourceยง

impl FromStr for Hash

Sourceยง

type Err = ParseHashError

The associated error which can be returned from parsing.
Sourceยง

fn from_str(s: &str) -> Result<Hash, <Hash as FromStr>::Err>

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

impl FromWasmAbi for Hash

Sourceยง

type Abi = u32

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Sourceยง

unsafe fn from_abi(js: u32) -> Hash

Recover a Self from Self::Abi. Read more
Sourceยง

impl Hash for Hash

Sourceยง

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

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 IntoWasmAbi for Hash

Sourceยง

type Abi = u32

The Wasm ABI type that this converts into when crossing the ABI boundary.
Sourceยง

fn into_abi(self) -> u32

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Sourceยง

impl LongRefFromWasmAbi for Hash

Sourceยง

type Abi = u32

Same as RefFromWasmAbi::Abi
Sourceยง

type Anchor = RcRef<Hash>

Same as RefFromWasmAbi::Anchor
Sourceยง

unsafe fn long_ref_from_abi( js: <Hash as LongRefFromWasmAbi>::Abi, ) -> <Hash as LongRefFromWasmAbi>::Anchor

Same as RefFromWasmAbi::ref_from_abi
Sourceยง

impl OptionFromWasmAbi for Hash

Sourceยง

fn is_none(abi: &<Hash as FromWasmAbi>::Abi) -> bool

Tests whether the argument is a โ€œnoneโ€ instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Sourceยง

impl OptionIntoWasmAbi for Hash

Sourceยง

fn none() -> <Hash as IntoWasmAbi>::Abi

Returns an ABI instance indicating โ€œnoneโ€, which JS will interpret as the None branch of this option. Read more
Sourceยง

impl Ord for Hash

Sourceยง

fn cmp(&self, other: &Hash) -> 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 for Hash

Sourceยง

fn eq(&self, other: &Hash) -> 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 Hash

Sourceยง

fn partial_cmp(&self, other: &Hash) -> 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 RefFromWasmAbi for Hash

Sourceยง

type Abi = u32

The Wasm ABI type references to Self are recovered from.
Sourceยง

type Anchor = RcRef<Hash>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes donโ€™t persist beyond one function call, and so that they remain anonymous.
Sourceยง

unsafe fn ref_from_abi( js: <Hash as RefFromWasmAbi>::Abi, ) -> <Hash as RefFromWasmAbi>::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Sourceยง

impl RefMutFromWasmAbi for Hash

Sourceยง

type Abi = u32

Same as RefFromWasmAbi::Abi
Sourceยง

type Anchor = RcRefMut<Hash>

Same as RefFromWasmAbi::Anchor
Sourceยง

unsafe fn ref_mut_from_abi( js: <Hash as RefMutFromWasmAbi>::Abi, ) -> <Hash as RefMutFromWasmAbi>::Anchor

Same as RefFromWasmAbi::ref_from_abi
Sourceยง

impl Sanitize for Hash

Sourceยง

impl Serialize for Hash

Sourceยง

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

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

impl TryFromJsValue for Hash

Sourceยง

type Error = JsValue

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

fn try_from_js_value( value: JsValue, ) -> Result<Hash, <Hash as TryFromJsValue>::Error>

Performs the conversion.
Sourceยง

impl VectorFromWasmAbi for Hash

Sourceยง

impl VectorIntoWasmAbi for Hash

Sourceยง

impl Zeroable for Hash

Sourceยง

impl Copy for Hash

Sourceยง

impl Eq for Hash

Sourceยง

impl Pod for Hash

Sourceยง

impl StructuralPartialEq for Hash

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> AbiEnumVisitor for T
where T: Serialize + ?Sized,

Sourceยง

default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>

Sourceยง

impl<T> AbiEnumVisitor for T
where T: Serialize + AbiExample + ?Sized,

Sourceยง

default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>

Sourceยง

impl<T> AbiExample for T

Sourceยง

default fn example() -> T

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> CheckedBitPattern for T
where T: AnyBitPattern,

Sourceยง

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Sourceยง

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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

Compare self to key and return 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

Checks if this value is equivalent to the given key. Read more
Sourceยง

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

Sourceยง

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

Compare self to key and return true if they are equal.
Sourceยง

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

Sourceยง

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

Checks if this value is equivalent to the given key. Read more
Sourceยง

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

Sourceยง

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

Compare self to key and return true if they are equal.
Sourceยง

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

Sourceยง

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

Checks if this value is equivalent to the given key. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<CustErr, T, Request> FromReq<Cbor, Request, CustErr> for T
where Request: Req<CustErr> + Send + 'static, T: DeserializeOwned,

Sourceยง

async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<CustErr, T, Request> FromReq<GetUrl, Request, CustErr> for T
where Request: Req<CustErr> + Send + 'static, T: DeserializeOwned,

Sourceยง

async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<CustErr, T, Request> FromReq<Json, Request, CustErr> for T
where Request: Req<CustErr> + Send + 'static, T: DeserializeOwned,

Sourceยง

async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<CustErr, T, Request> FromReq<PostUrl, Request, CustErr> for T
where Request: Req<CustErr> + Send + 'static, T: DeserializeOwned,

Sourceยง

async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<CustErr, T, Response> FromRes<Cbor, Response, CustErr> for T
where Response: ClientRes<CustErr> + Send, T: DeserializeOwned + Send,

Sourceยง

async fn from_res(res: Response) -> Result<T, ServerFnError<CustErr>>

Attempts to deserialize the outputs from a response.
Sourceยง

impl<CustErr, T, Response> FromRes<Json, Response, CustErr> for T
where Response: ClientRes<CustErr> + Send, T: DeserializeOwned + Send,

Sourceยง

async fn from_res(res: Response) -> Result<T, ServerFnError<CustErr>>

Attempts to deserialize the outputs from a response.
Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Sourceยง

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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Sourceยง

impl<T> IntoPropValue<Option<T>> for T

Sourceยง

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
Sourceยง

impl<T> IntoPropValue<T> for T

Sourceยง

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
Sourceยง

impl<CustErr, T, Request> IntoReq<Cbor, Request, CustErr> for T
where Request: ClientReq<CustErr>, T: Serialize + Send,

Sourceยง

fn into_req( self, path: &str, accepts: &str, ) -> Result<Request, ServerFnError<CustErr>>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<CustErr, T, Request> IntoReq<GetUrl, Request, CustErr> for T
where Request: ClientReq<CustErr>, T: Serialize + Send,

Sourceยง

fn into_req( self, path: &str, accepts: &str, ) -> Result<Request, ServerFnError<CustErr>>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<CustErr, T, Request> IntoReq<Json, Request, CustErr> for T
where Request: ClientReq<CustErr>, T: Serialize + Send,

Sourceยง

fn into_req( self, path: &str, accepts: &str, ) -> Result<Request, ServerFnError<CustErr>>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<CustErr, T, Request> IntoReq<PostUrl, Request, CustErr> for T
where Request: ClientReq<CustErr>, T: Serialize + Send,

Sourceยง

fn into_req( self, path: &str, accepts: &str, ) -> Result<Request, ServerFnError<CustErr>>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<CustErr, T, Response> IntoRes<Cbor, Response, CustErr> for T
where Response: Res<CustErr>, T: Serialize + Send,

Sourceยง

async fn into_res(self) -> Result<Response, ServerFnError<CustErr>>

Attempts to serialize the output into an HTTP response.
Sourceยง

impl<CustErr, T, Response> IntoRes<Json, Response, CustErr> for T
where Response: Res<CustErr>, T: Serialize + Send,

Sourceยง

async fn into_res(self) -> Result<Response, ServerFnError<CustErr>>

Attempts to serialize the output into an HTTP response.
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> ReturnWasmAbi for T
where T: IntoWasmAbi,

Sourceยง

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Sourceยง

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

impl<T> Serializable for T

Sourceยง

fn ser(&self) -> Result<String, SerializationError>

Serializes the object to a string.
Sourceยง

fn de(json: &str) -> Result<T, SerializationError>

Deserializes the object from some bytes.
Sourceยง

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Sourceยง

fn super_from(input: T) -> O

Convert from a type to another type.
Sourceยง

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Sourceยง

fn super_into(self) -> O

Convert from a type to another type.
Sourceยง

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

Sourceยง

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
Sourceยง

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
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<Cfg> TryIntoConfig for Cfg

Sourceยง

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

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

impl<Token, Builder, How> AllPropsFor<Builder, How> for Token
where Builder: Buildable<Token>, <Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,

Sourceยง

impl<T> AnyBitPattern for T
where T: Pod,

Sourceยง

impl<T> DependencyElement for T
where T: 'static + PartialEq + Clone,

Sourceยง

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

Sourceยง

impl<El> ElementDescriptorBounds for El
where El: Debug,

Sourceยง

impl<T> ErasedDestructor for T
where T: 'static,

Sourceยง

impl<T> HasAllProps<(), T> for T

Sourceยง

impl<T> NoUninit for T
where T: Pod,