#[repr(C)]pub struct H256(pub [u8; 32]);
Expand description
A byte array of length 32 representing the block hash, etc.
Tuple Fields§
§0: [u8; 32]
Implementations§
Source§impl H256
impl H256
Sourcepub const fn repeat_byte(byte: u8) -> H256
pub const fn repeat_byte(byte: u8) -> H256
Returns a new fixed hash where all bits are set to the given byte.
Sourcepub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
Extracts a mutable byte slice containing the entire fixed hash.
Sourcepub const fn as_fixed_bytes(&self) -> &[u8; 32]
pub const fn as_fixed_bytes(&self) -> &[u8; 32]
Extracts a reference to the byte array containing the entire fixed hash.
Sourcepub fn as_fixed_bytes_mut(&mut self) -> &mut [u8; 32]
pub fn as_fixed_bytes_mut(&mut self) -> &mut [u8; 32]
Extracts a reference to the byte array containing the entire fixed hash.
Sourcepub const fn to_fixed_bytes(self) -> [u8; 32]
pub const fn to_fixed_bytes(self) -> [u8; 32]
Returns the inner bytes array.
Sourcepub fn as_mut_ptr(&mut self) -> *mut u8
pub fn as_mut_ptr(&mut self) -> *mut u8
Returns a mutable raw pointer to the value.
Sourcepub fn assign_from_slice(&mut self, src: &[u8])
pub fn assign_from_slice(&mut self, src: &[u8])
Sourcepub fn from_slice(src: &[u8]) -> Self
pub fn from_slice(src: &[u8]) -> Self
Trait Implementations§
Source§impl<'r> BitAndAssign<&'r H256> for H256
impl<'r> BitAndAssign<&'r H256> for H256
Source§fn bitand_assign(&mut self, rhs: &'r H256)
fn bitand_assign(&mut self, rhs: &'r H256)
Performs the
&=
operation. Read moreSource§impl BitAndAssign for H256
impl BitAndAssign for H256
Source§fn bitand_assign(&mut self, rhs: H256)
fn bitand_assign(&mut self, rhs: H256)
Performs the
&=
operation. Read moreSource§impl<'r> BitOrAssign<&'r H256> for H256
impl<'r> BitOrAssign<&'r H256> for H256
Source§fn bitor_assign(&mut self, rhs: &'r H256)
fn bitor_assign(&mut self, rhs: &'r H256)
Performs the
|=
operation. Read moreSource§impl BitOrAssign for H256
impl BitOrAssign for H256
Source§fn bitor_assign(&mut self, rhs: H256)
fn bitor_assign(&mut self, rhs: H256)
Performs the
|=
operation. Read moreSource§impl<'r> BitXorAssign<&'r H256> for H256
impl<'r> BitXorAssign<&'r H256> for H256
Source§fn bitxor_assign(&mut self, rhs: &'r H256)
fn bitxor_assign(&mut self, rhs: &'r H256)
Performs the
^=
operation. Read moreSource§impl BitXorAssign for H256
impl BitXorAssign for H256
Source§fn bitxor_assign(&mut self, rhs: H256)
fn bitxor_assign(&mut self, rhs: H256)
Performs the
^=
operation. Read moreSource§impl Decode for H256
impl Decode for H256
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.
Source§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
Source§impl Encode for H256
impl Encode for H256
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.
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl Ord for H256
impl Ord for H256
Source§impl PartialOrd for H256
impl PartialOrd for H256
Source§impl Serialize for H256
impl Serialize for H256
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
impl Copy for H256
impl EncodeLike for H256
impl Eq for H256
Auto Trait Implementations§
impl Freeze for H256
impl RefUnwindSafe for H256
impl Send for H256
impl Sync for H256
impl Unpin for H256
impl UnwindSafe for H256
Blanket Implementations§
Source§impl<T, U> AsByteSlice<T> for U
impl<T, U> AsByteSlice<T> for U
fn as_byte_slice(&self) -> &[u8] ⓘ
Source§impl<T, U> AsMutByteSlice<T> for U
impl<T, U> AsMutByteSlice<T> for U
fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
Source§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,
Source§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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> SpreadLayout for T
impl<T> SpreadLayout for T
Source§fn read_ledger(key: &[u8], _: &[u8]) -> T
fn read_ledger(key: &[u8], _: &[u8]) -> T
从账本读数据接口
Source§fn write_ledger(&self, key: &[u8], _: &[u8])
fn write_ledger(&self, key: &[u8], _: &[u8])
写入账本数据接口,key为属性名