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§
Trait Implementations§
source§impl BorshDeserialize for Hash
impl BorshDeserialize for Hash
fn deserialize_reader<__R>(reader: &mut __R) -> Result<Hash, Error>where
__R: Read,
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 BorshSchema for Hash
impl BorshSchema for Hash
source§fn declaration() -> String
fn declaration() -> String
Get the name of the type without brackets.
source§fn add_definitions_recursively(definitions: &mut BTreeMap<String, Definition>)
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
impl BorshSerialize for Hash
source§impl<'de> Deserialize<'de> for Hash
impl<'de> Deserialize<'de> for Hash
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Hash, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
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 From<Hash> for MessageHash
impl From<Hash> for MessageHash
source§impl FromWasmAbi for Hash
impl FromWasmAbi for Hash
source§impl IntoWasmAbi for Hash
impl IntoWasmAbi for Hash
source§impl LongRefFromWasmAbi for Hash
impl LongRefFromWasmAbi for Hash
source§impl OptionFromWasmAbi for Hash
impl OptionFromWasmAbi for Hash
source§impl OptionIntoWasmAbi for Hash
impl OptionIntoWasmAbi for Hash
source§impl Ord for Hash
impl Ord for Hash
source§impl PartialOrd for Hash
impl PartialOrd for Hash
source§impl RefFromWasmAbi for Hash
impl RefFromWasmAbi for Hash
source§type Anchor = RcRef<Hash>
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
unsafe fn ref_from_abi( js: <Hash as RefFromWasmAbi>::Abi, ) -> <Hash as RefFromWasmAbi>::Anchor
source§impl RefMutFromWasmAbi for Hash
impl RefMutFromWasmAbi for Hash
source§impl Serialize for Hash
impl Serialize for Hash
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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
impl TryFromJsValue for Hash
source§impl VectorFromWasmAbi for Hash
impl VectorFromWasmAbi for Hash
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: <Hash as VectorFromWasmAbi>::Abi) -> Box<[Hash]>
source§impl VectorIntoWasmAbi for Hash
impl VectorIntoWasmAbi for Hash
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Hash]>) -> <Hash as VectorIntoWasmAbi>::Abi
impl Copy for Hash
impl Eq for Hash
impl Pod for Hash
impl StructuralPartialEq for Hash
Auto Trait Implementations§
impl Freeze for Hash
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnwindSafe for Hash
Blanket Implementations§
source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
source§type Bits = T
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
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 Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
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
.