Trait gstd::prelude::Decode

source ·
pub trait Decode: Sized {
    // Required method
    fn decode<I>(input: &mut I) -> Result<Self, Error>
       where I: Input;

    // Provided methods
    fn decode_into<I>(
        input: &mut I,
        dst: &mut MaybeUninit<Self>
    ) -> Result<DecodeFinished, Error>
       where I: Input { ... }
    fn skip<I>(input: &mut I) -> Result<(), Error>
       where I: Input { ... }
    fn encoded_fixed_size() -> Option<usize> { ... }
}
Expand description

Trait that allows zero-copy read of value-references from slices in LE format.

Required Methods§

source

fn decode<I>(input: &mut I) -> Result<Self, Error>
where I: Input,

Attempt to deserialise the value from input.

Provided Methods§

source

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.

The default implementation will just call Decode::decode.

§Safety

If this function returns Ok then dst must be properly initialized.

This is enforced by requiring the implementation to return a DecodeFinished which can only be created by calling DecodeFinished::assert_decoding_finished which is unsafe.

source

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input.

The default implementation of this function is just calling Decode::decode. When possible, an implementation should provide a specialized implementation.

source

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type.

If it returns Some(size) then all possible values of this type have the given size (in bytes) when encoded.

NOTE: A type with a fixed encoded size may return None.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Decode for bool

source§

impl Decode for f32

source§

impl Decode for f64

source§

impl Decode for i8

source§

fn decode<I>(input: &mut I) -> Result<i8, Error>
where I: Input,

source§

impl Decode for i16

source§

impl Decode for i32

source§

impl Decode for i64

source§

impl Decode for i128

source§

impl Decode for u8

source§

fn decode<I>(input: &mut I) -> Result<u8, Error>
where I: Input,

source§

impl Decode for u16

source§

impl Decode for u32

source§

impl Decode for u64

source§

impl Decode for u128

source§

impl Decode for ()

source§

fn decode<I>(_: &mut I) -> Result<(), Error>
where I: Input,

source§

impl Decode for H128

source§

fn decode<I>(input: &mut I) -> Result<H128, Error>
where I: Input,

source§

impl Decode for H160

source§

fn decode<I>(input: &mut I) -> Result<H160, Error>
where I: Input,

source§

impl Decode for H256

source§

fn decode<I>(input: &mut I) -> Result<H256, Error>
where I: Input,

source§

impl Decode for H384

source§

fn decode<I>(input: &mut I) -> Result<H384, Error>
where I: Input,

source§

impl Decode for H512

source§

fn decode<I>(input: &mut I) -> Result<H512, Error>
where I: Input,

source§

impl Decode for H768

source§

fn decode<I>(input: &mut I) -> Result<H768, Error>
where I: Input,

source§

impl Decode for U128

source§

fn decode<I>(input: &mut I) -> Result<U128, Error>
where I: Input,

source§

impl Decode for U256

source§

fn decode<I>(input: &mut I) -> Result<U256, Error>
where I: Input,

source§

impl Decode for U512

source§

fn decode<I>(input: &mut I) -> Result<U512, Error>
where I: Input,

source§

impl<A0, B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (A0, B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where A0: Decode, B0: Decode, C0: Decode, D0: Decode, E0: Decode, F0: Decode, G0: Decode, H0: Decode, I0: Decode, J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where B0: Decode, C0: Decode, D0: Decode, E0: Decode, F0: Decode, G0: Decode, H0: Decode, I0: Decode, J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where C0: Decode, D0: Decode, E0: Decode, F0: Decode, G0: Decode, H0: Decode, I0: Decode, J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where D0: Decode, E0: Decode, F0: Decode, G0: Decode, H0: Decode, I0: Decode, J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where E0: Decode, F0: Decode, G0: Decode, H0: Decode, I0: Decode, J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where F0: Decode, G0: Decode, H0: Decode, I0: Decode, J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where G0: Decode, H0: Decode, I0: Decode, J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where H0: Decode, I0: Decode, J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where I0: Decode, J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<J0, K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (J0, K0, L0, M0, N0, O0, P0, Q0, R0)
where J0: Decode, K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<K0, L0, M0, N0, O0, P0, Q0, R0> Decode for (K0, L0, M0, N0, O0, P0, Q0, R0)
where K0: Decode, L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<L0, M0, N0, O0, P0, Q0, R0> Decode for (L0, M0, N0, O0, P0, Q0, R0)
where L0: Decode, M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<M0, N0, O0, P0, Q0, R0> Decode for (M0, N0, O0, P0, Q0, R0)
where M0: Decode, N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

impl<N0, O0, P0, Q0, R0> Decode for (N0, O0, P0, Q0, R0)
where N0: Decode, O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

fn decode<INPUT>(input: &mut INPUT) -> Result<(N0, O0, P0, Q0, R0), Error>
where INPUT: Input,

source§

impl<O0, P0, Q0, R0> Decode for (O0, P0, Q0, R0)
where O0: Decode, P0: Decode, Q0: Decode, R0: Decode,

source§

fn decode<INPUT>(input: &mut INPUT) -> Result<(O0, P0, Q0, R0), Error>
where INPUT: Input,

source§

impl<P0, Q0, R0> Decode for (P0, Q0, R0)
where P0: Decode, Q0: Decode, R0: Decode,

source§

fn decode<INPUT>(input: &mut INPUT) -> Result<(P0, Q0, R0), Error>
where INPUT: Input,

source§

impl<Q0, R0> Decode for (Q0, R0)
where Q0: Decode, R0: Decode,

source§

fn decode<INPUT>(input: &mut INPUT) -> Result<(Q0, R0), Error>
where INPUT: Input,

source§

impl<R0> Decode for (R0,)
where R0: Decode,

source§

fn decode<I>(input: &mut I) -> Result<(R0,), Error>
where I: Input,

source§

impl<T> Decode for UntrackedSymbol<T>
where PhantomData<fn() -> T>: Decode,

source§

fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<UntrackedSymbol<T>, Error>
where __CodecInputEdqy: Input,

source§

impl<T, const N: usize> Decode for [T; N]
where T: Decode,

source§

fn decode<I>(input: &mut I) -> Result<[T; N], Error>
where I: Input,

source§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<[T; N]> ) -> Result<DecodeFinished, Error>
where I: Input,

source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

source§

fn encoded_fixed_size() -> Option<usize>

Implementors§

source§

impl Decode for ErrorReplyReason

source§

impl Decode for ExtError

source§

impl Decode for ReplyCode

source§

impl Decode for SignalCode

source§

impl Decode for SimpleExecutionError

source§

impl Decode for SimpleProgramCreationError

source§

impl Decode for SuccessReplyReason

source§

impl Decode for ActorId

source§

impl Decode for CodeId

source§

impl Decode for MessageId

source§

impl Decode for Reservation

source§

impl Decode for ReservationId

source§

impl Decode for Reservations

source§

impl Decode for OptionBool

source§

impl Decode for Compact<u8>

source§

impl Decode for Compact<u16>

source§

impl Decode for Compact<u32>

source§

impl Decode for Compact<u64>

source§

impl Decode for Compact<u128>

source§

impl Decode for Compact<()>

source§

impl Decode for NonZeroI8

source§

impl Decode for NonZeroI16

source§

impl Decode for NonZeroI32

source§

impl Decode for NonZeroI64

source§

impl Decode for NonZeroI128

source§

impl Decode for NonZeroU8

source§

impl Decode for NonZeroU16

source§

impl Decode for NonZeroU32

source§

impl Decode for NonZeroU64

source§

impl Decode for NonZeroU128

source§

impl Decode for String

source§

impl Decode for Duration

source§

impl<'a, T> Decode for Cow<'a, T>
where T: ToOwned + ?Sized, <T as ToOwned>::Owned: Decode,

source§

impl<K, V> Decode for BTreeMap<K, V>
where K: Decode + Ord, V: Decode,

source§

impl<T> Decode for Option<T>
where T: Decode,

source§

impl<T> Decode for BTreeSet<T>
where T: Decode + Ord,

source§

impl<T> Decode for BinaryHeap<T>
where T: Decode + Ord,

source§

impl<T> Decode for LinkedList<T>
where T: Decode,

source§

impl<T> Decode for VecDeque<T>
where T: Decode,

source§

impl<T> Decode for Compact<T>
where T: CompactAs, Compact<<T as CompactAs>::As>: Decode,

source§

impl<T> Decode for PhantomData<T>

source§

impl<T> Decode for Range<T>
where T: Decode,

source§

impl<T> Decode for RangeInclusive<T>
where T: Decode,

source§

impl<T> Decode for Vec<T>
where T: Decode,

source§

impl<T, E> Decode for Result<T, E>
where T: Decode, E: Decode,

source§

impl<T, X> Decode for X
where T: Decode + Into<X>, X: WrapperTypeDecode<Wrapped = T>,