Struct sp_inherents::InherentData
source · [−]pub struct InherentData { /* private fields */ }
Expand description
Inherent data to include in a block.
Implementations
sourceimpl InherentData
impl InherentData
sourcepub fn put_data<I: Encode>(
&mut self,
identifier: InherentIdentifier,
inherent: &I
) -> Result<(), Error>
pub fn put_data<I: Encode>(
&mut self,
identifier: InherentIdentifier,
inherent: &I
) -> Result<(), Error>
Put data for an inherent into the internal storage.
Return
Returns Ok(())
if the data could be inserted and no data for an inherent with the same
identifier existed, otherwise an error is returned.
Inherent identifiers need to be unique, otherwise decoding of these values will not work!
sourcepub fn replace_data<I: Encode>(
&mut self,
identifier: InherentIdentifier,
inherent: &I
)
pub fn replace_data<I: Encode>(
&mut self,
identifier: InherentIdentifier,
inherent: &I
)
Replace the data for an inherent.
If it does not exist, the data is just inserted.
sourcepub fn get_data<I: Decode>(
&self,
identifier: &InherentIdentifier
) -> Result<Option<I>, Error>
pub fn get_data<I: Decode>(
&self,
identifier: &InherentIdentifier
) -> Result<Option<I>, Error>
Returns the data for the requested inherent.
Return
Ok(Some(I))
if the data could be found and deserialized.Ok(None)
if the data could not be found.Err(_)
if the data could be found, but deserialization did not work.
Trait Implementations
sourceimpl Clone for InherentData
impl Clone for InherentData
sourcefn clone(&self) -> InherentData
fn clone(&self) -> InherentData
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Decode for InherentData
impl Decode for InherentData
sourcefn 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.
sourcefn 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
sourcefn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
sourceimpl Default for InherentData
impl Default for InherentData
sourcefn default() -> InherentData
fn default() -> InherentData
Returns the “default value” for a type. Read more
sourceimpl Encode for InherentData
impl Encode for InherentData
sourcefn 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.
sourcefn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
sourcefn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
impl EncodeLike<InherentData> for InherentData
Auto Trait Implementations
impl RefUnwindSafe for InherentData
impl Send for InherentData
impl Sync for InherentData
impl Unpin for InherentData
impl UnwindSafe for InherentData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> DecodeLimit for T where
T: Decode,
impl<T> DecodeLimit for T where
T: Decode,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more