Struct ink_primitives::Hash
source · pub struct Hash(/* private fields */);
Expand description
The default environment Hash
type.
§Note
This is a mirror of the Hash
type used in the default configuration
of PALLET contracts.
Trait Implementations§
source§impl Decode for Hash
impl Decode for Hash
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
Attempt to skip the encoded value from input. Read more
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
source§impl Encode for Hash
impl Encode for Hash
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Convert self to a slice and then invoke the given closure with it.
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl EncodeAsFields for Hash
impl EncodeAsFields for Hash
source§fn encode_as_fields_to<ScaleEncodeResolver: TypeResolver>(
&self,
__encode_as_type_fields: &mut dyn FieldIter<'_, ScaleEncodeResolver::TypeId>,
__encode_as_type_types: &ScaleEncodeResolver,
__encode_as_type_out: &mut Vec<u8>,
) -> Result<(), Error>
fn encode_as_fields_to<ScaleEncodeResolver: TypeResolver>( &self, __encode_as_type_fields: &mut dyn FieldIter<'_, ScaleEncodeResolver::TypeId>, __encode_as_type_types: &ScaleEncodeResolver, __encode_as_type_out: &mut Vec<u8>, ) -> Result<(), Error>
Given some fields describing the shape of a type, attempt to encode to that shape.
§fn encode_as_fields<R>(
&self,
fields: &mut dyn FieldIter<'_, <R as TypeResolver>::TypeId, Item = Field<'_, <R as TypeResolver>::TypeId>>,
types: &R,
) -> Result<Vec<u8>, Error>where
R: TypeResolver,
fn encode_as_fields<R>(
&self,
fields: &mut dyn FieldIter<'_, <R as TypeResolver>::TypeId, Item = Field<'_, <R as TypeResolver>::TypeId>>,
types: &R,
) -> Result<Vec<u8>, Error>where
R: TypeResolver,
This is a helper function which internally calls [
EncodeAsFields::encode_as_fields_to
]. Prefer to
implement that instead.source§impl EncodeAsType for Hash
impl EncodeAsType for Hash
source§fn encode_as_type_to<ScaleEncodeResolver: TypeResolver>(
&self,
__encode_as_type_type_id: &ScaleEncodeResolver::TypeId,
__encode_as_type_types: &ScaleEncodeResolver,
__encode_as_type_out: &mut Vec<u8>,
) -> Result<(), Error>
fn encode_as_type_to<ScaleEncodeResolver: TypeResolver>( &self, __encode_as_type_type_id: &ScaleEncodeResolver::TypeId, __encode_as_type_types: &ScaleEncodeResolver, __encode_as_type_out: &mut Vec<u8>, ) -> Result<(), Error>
Given some
type_id
, types
, a context
and some output target for the SCALE encoded bytes,
attempt to SCALE encode the current value into the type given by type_id
.source§impl IntoVisitor for Hash
impl IntoVisitor for Hash
§type AnyVisitor<ScaleDecodeTypeResolver: TypeResolver> = Visitor<ScaleDecodeTypeResolver>
type AnyVisitor<ScaleDecodeTypeResolver: TypeResolver> = Visitor<ScaleDecodeTypeResolver>
The visitor type used to decode SCALE encoded bytes to
Self
.source§fn into_visitor<ScaleDecodeTypeResolver: TypeResolver>() -> Self::AnyVisitor<ScaleDecodeTypeResolver>
fn into_visitor<ScaleDecodeTypeResolver: TypeResolver>() -> Self::AnyVisitor<ScaleDecodeTypeResolver>
A means of obtaining this visitor.
source§impl MaxEncodedLen for Hash
impl MaxEncodedLen for Hash
source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
source§impl Ord for Hash
impl Ord for Hash
source§impl PartialEq for Hash
impl PartialEq for Hash
source§impl PartialOrd for Hash
impl PartialOrd for Hash
1.0.0 · source§fn 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 moresource§impl<'a> TryFrom<&'a [u8]> for Hash
impl<'a> TryFrom<&'a [u8]> for Hash
§type Error = TryFromSliceError
type Error = TryFromSliceError
The type returned in the event of a conversion error.
impl Copy for Hash
impl EncodeLike for Hash
impl Eq 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§
§impl<T, U> AsByteSlice<T> for U
impl<T, U> AsByteSlice<T> for U
fn as_byte_slice(&self) -> &[u8] ⓘ
§impl<T, U> AsMutByteSlice<T> for U
impl<T, U> AsMutByteSlice<T> for U
fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
§impl<U> AsMutSliceOf for U
impl<U> AsMutSliceOf for U
fn as_mut_slice_of<T>(&mut self) -> Result<&mut [T], Error>where
T: FromByteSlice,
§impl<U> AsSliceOf for U
impl<U> AsSliceOf for U
fn as_slice_of<T>(&self) -> Result<&[T], Error>where
T: FromByteSlice,
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> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere
T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Decode
Self
and consume all of the given input data. Read more§impl<T> DecodeAsType for Twhere
T: IntoVisitor,
impl<T> DecodeAsType for Twhere
T: IntoVisitor,
fn decode_as_type_maybe_compact<R>(
input: &mut &[u8],
type_id: &<R as TypeResolver>::TypeId,
types: &R,
is_compact: bool,
) -> Result<T, Error>where
R: TypeResolver,
§fn decode_as_type<R>(
input: &mut &[u8],
type_id: &<R as TypeResolver>::TypeId,
types: &R,
) -> Result<Self, Error>where
R: TypeResolver,
fn decode_as_type<R>(
input: &mut &[u8],
type_id: &<R as TypeResolver>::TypeId,
types: &R,
) -> Result<Self, Error>where
R: TypeResolver,
Given some input bytes, a
type_id
, and type registry, attempt to decode said bytes into
Self
. Implementations should modify the &mut
reference to the bytes such that any bytes
not used in the course of decoding are still pointed to after decoding is complete.§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere
T: Codec,
§fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
Return an encoding of
Self
prepended by given slice.