jam_types

Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Decode for TypeDefPrimitive

Source§

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

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 String

Source§

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

Source§

impl Decode for NonZero<i8>

Source§

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

Source§

impl Decode for NonZero<i16>

Source§

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

Source§

impl Decode for NonZero<i32>

Source§

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

Source§

impl Decode for NonZero<i64>

Source§

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

Source§

impl Decode for NonZero<i128>

Source§

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

Source§

impl Decode for NonZero<u8>

Source§

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

Source§

impl Decode for NonZero<u16>

Source§

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

Source§

impl Decode for NonZero<u32>

Source§

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

Source§

impl Decode for NonZero<u64>

Source§

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

Source§

impl Decode for NonZero<u128>

Source§

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

Source§

impl Decode for Duration

Source§

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

Source§

impl Decode for PortableRegistry

Source§

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

Source§

impl Decode for PortableType

Source§

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

Source§

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

Source§

fn decode<I>(input: &mut I) -> Result<Cow<'a, T>, 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<K, V> Decode for BTreeMap<K, V>
where K: Decode + Ord, V: Decode,

Source§

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

Source§

impl<K, V, S> Decode for BoundedBTreeMap<K, V, S>
where K: Decode + Ord, V: Decode, S: Get<u32>,

Source§

fn decode<I>(input: &mut I) -> Result<BoundedBTreeMap<K, V, S>, Error>
where I: Input,

Source§

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

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 Option<T>
where T: Decode,

Source§

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

Source§

impl<T> Decode for TypeDef<T>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<T> Decode for PhantomData<T>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn decode<I>(input: &mut I) -> Result<RangeInclusive<T>, 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> Decode for TypeDefComposite<T>
where T: Form, Vec<Field<T>>: Decode,

Source§

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

Source§

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,

Source§

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

Source§

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

Source§

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

Source§

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,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<T, S> Decode for BoundedBTreeSet<T, S>
where T: Decode + Ord, S: Get<u32>,

Source§

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

Source§

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

Source§

impl<T, S> Decode for WeakBoundedVec<T, S>
where T: Decode, S: Get<u32>,

Source§

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

Source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: 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 WorkError

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 AccumulateRootHash

Source§

impl Decode for AnyHash

Source§

impl Decode for AnyVec

Source§

impl Decode for AuthOutput

Source§

impl Decode for AuthParam

Source§

impl Decode for Authorization

Source§

impl Decode for AuthorizerHash

Source§

impl Decode for Bundle

Source§

impl Decode for Code

Source§

impl Decode for CodeHash

Source§

impl Decode for ExtrinsicHash

Source§

impl Decode for HeaderHash

Source§

impl Decode for ItemHash

Source§

impl Decode for Memo

Source§

impl Decode for MerkleNodeHash

Source§

impl Decode for MmrPeakHash

Source§

impl Decode for OpaqueBandersnatchPublic

Source§

impl Decode for OpaqueEd25519Public

Source§

impl Decode for OpaqueValidatorMetadata

Source§

impl Decode for PayloadHash

Source§

impl Decode for SegmentHash

Source§

impl Decode for SegmentTreeRoot

Source§

impl Decode for StateRootHash

Source§

impl Decode for WorkOutput

Source§

impl Decode for WorkPackageHash

Source§

impl Decode for WorkPayload

Source§

impl Decode for WorkReportHash

Source§

impl Decode for AccumulateItem

Source§

impl Decode for AccumulateParams

Source§

impl Decode for Authorizer

Source§

impl Decode for ExtrinsicSpec

Source§

impl Decode for ImportSpec

Source§

impl Decode for OnChainContext

Source§

impl Decode for OnTransferParams

Source§

impl Decode for OpaqueValKeyset

Source§

impl Decode for PackageInfo

Source§

impl Decode for RefineContext

Source§

impl Decode for RefineParams

Source§

impl Decode for ServiceInfo

Source§

impl Decode for TransferRecord

Source§

impl Decode for WorkResult

Source§

impl<K: Decode + Eq + PartialEq + Ord + PartialOrd, V: Decode> Decode for VecMap<K, V>

Source§

impl<RegT> Decode for InvokeArgsT<RegT>
where RegT: Decode, [RegT; 13]: Decode,

Source§

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

Source§

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

Source§

impl<T, S> Decode for BoundedVec<T, S>
where T: Decode, S: Get<u32>,

Source§

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

Source§

impl<T: Decode + Eq + PartialEq + Ord + PartialOrd> Decode for VecSet<T>

Source§

impl<T: Decode, N: Get<u32>> Decode for FixedVec<T, N>

Source§

impl<Xt> Decode for GenericWorkItem<Xt>
where Vec<Xt>: Decode,

Source§

impl<Xt> Decode for GenericWorkPackage<Xt>