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 Bytes

§

fn decode<I>(input: &mut I) -> Result<Bytes, 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 PortableRegistry

§

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

§

impl Decode for PortableType

§

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

§

impl Decode for TypeDefPrimitive

§

fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<TypeDefPrimitive, Error>
where __CodecInputEdqy: 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,

§

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

§

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,

§

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

§

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 Field<T>
where T: Form, Option<<T as Form>::String>: Decode, <T as Form>::Type: Decode, Vec<<T as Form>::String>: Decode,

§

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

§

impl<T> Decode for Path<T>
where T: Form, Vec<<T as Form>::String>: Decode,

§

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

§

impl<T> Decode for Type<T>
where T: Form, Path<T>: Decode, Vec<TypeParameter<T>>: Decode, TypeDef<T>: Decode, Vec<<T as Form>::String>: Decode,

§

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

§

impl<T> Decode for TypeDef<T>
where T: Form, TypeDefComposite<T>: Decode, TypeDefVariant<T>: Decode, TypeDefSequence<T>: Decode, TypeDefArray<T>: Decode, TypeDefTuple<T>: Decode, TypeDefCompact<T>: Decode, TypeDefBitSequence<T>: Decode,

§

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

§

impl<T> Decode for TypeDefArray<T>
where T: Form, <T as Form>::Type: Decode,

§

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

§

impl<T> Decode for TypeDefBitSequence<T>
where T: Form, <T as Form>::Type: Decode,

§

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

§

impl<T> Decode for TypeDefCompact<T>
where T: Form, <T as Form>::Type: Decode,

§

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

§

impl<T> Decode for TypeDefComposite<T>
where T: Form, Vec<Field<T>>: Decode,

§

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

§

impl<T> Decode for TypeDefSequence<T>
where T: Form, <T as Form>::Type: Decode,

§

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

§

impl<T> Decode for TypeDefTuple<T>
where T: Form, Vec<<T as Form>::Type>: Decode,

§

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

§

impl<T> Decode for TypeDefVariant<T>
where T: Form, Vec<Variant<T>>: Decode,

§

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

§

impl<T> Decode for TypeParameter<T>
where T: Form, <T as Form>::String: Decode, Option<<T as Form>::Type>: Decode,

§

fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<TypeParameter<T>, Error>
where __CodecInputEdqy: 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> Decode for Variant<T>
where T: Form, <T as Form>::String: Decode, Vec<Field<T>>: Decode, Vec<<T as Form>::String>: Decode,

§

fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<Variant<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§

§

impl Decode for ErrorReplyReason

§

impl Decode for ExtError

§

impl Decode for ReplyCode

§

impl Decode for SignalCode

§

impl Decode for SimpleExecutionError

§

impl Decode for SimpleProgramCreationError

§

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

§

impl Decode for NonZeroI8

§

impl Decode for NonZeroI16

§

impl Decode for NonZeroI32

§

impl Decode for NonZeroI64

§

impl Decode for NonZeroI128

§

impl Decode for NonZeroU8

§

impl Decode for NonZeroU16

§

impl Decode for NonZeroU32

§

impl Decode for NonZeroU64

§

impl Decode for NonZeroU128

§

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>,