Trait gstd::prelude::Decode

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§

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

Attempt to deserialise the value from input.

Provided Methods§

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.

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.

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§

§

impl Decode for bool

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for f32

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for f64

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for i8

§

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

§

impl Decode for i16

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for i32

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for i64

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for i128

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for u8

§

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

§

impl Decode for u16

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for u32

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for u64

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for u128

§

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

§

fn encoded_fixed_size() -> Option<usize>

§

impl Decode for ()

§

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

§

impl Decode for H128

§

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

§

impl Decode for H160

§

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

§

impl Decode for H256

§

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

§

impl Decode for H384

§

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

§

impl Decode for H512

§

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

§

impl Decode for H768

§

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

§

impl Decode for MessageHandle

§

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

§

fn decode_into<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy, dst_: &mut MaybeUninit<MessageHandle>, ) -> Result<DecodeFinished, Error>
where __CodecInputEdqy: Input,

§

impl Decode for NonZeroU256

§

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

§

impl Decode for U128

§

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

§

impl Decode for U256

§

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

§

impl Decode for U512

§

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

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

fn decode<INPUT>( input: &mut INPUT, ) -> Result<(H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0), Error>
where INPUT: Input,

§

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,

§

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

§

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,

§

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

§

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,

§

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

§

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,

§

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

§

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,

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

impl Decode for ActorId

§

impl Decode for CodeId

§

impl Decode for MessageId

source§

impl Decode for Reservation

§

impl Decode for ReservationId

source§

impl Decode for Reservations

§

impl Decode for NonZero<i8>

§

impl Decode for NonZero<i16>

§

impl Decode for NonZero<i32>

§

impl Decode for NonZero<i64>

§

impl Decode for NonZero<i128>

§

impl Decode for NonZero<u8>

§

impl Decode for NonZero<u16>

§

impl Decode for NonZero<u32>

§

impl Decode for NonZero<u64>

§

impl Decode for NonZero<u128>

§

impl Decode for String

§

impl Decode for Duration

§

impl Decode for Compact<u8>

§

impl Decode for Compact<u16>

§

impl Decode for Compact<u32>

§

impl Decode for Compact<u64>

§

impl Decode for Compact<u128>

§

impl Decode for Compact<()>

§

impl Decode for OptionBool

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<T> Decode for PhantomData<T>

§

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

§

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

§

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

§

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

§

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

§

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