pub enum TypeDef<T: Form = MetaForm> {
Composite(TypeDefComposite<T>),
Variant(TypeDefVariant<T>),
Sequence(TypeDefSequence<T>),
Array(TypeDefArray<T>),
Tuple(TypeDefTuple<T>),
Primitive(TypeDefPrimitive),
Compact(TypeDefCompact<T>),
BitSequence(TypeDefBitSequence<T>),
}
Expand description
The possible types a SCALE encodable Rust value could have.
§Note
In order to preserve backwards compatibility, variant indices are explicitly specified instead of depending on the default implicit ordering.
When adding a new variant, it must be added at the end with an incremented index.
When removing an existing variant, the rest of variant indices remain the same, and the removed index should not be reused.
Variants§
Composite(TypeDefComposite<T>)
A composite type (e.g. a struct or a tuple)
Variant(TypeDefVariant<T>)
A variant type (e.g. an enum)
Sequence(TypeDefSequence<T>)
A sequence type with runtime known length.
Array(TypeDefArray<T>)
An array type with compile-time known length.
Tuple(TypeDefTuple<T>)
A tuple type.
Primitive(TypeDefPrimitive)
A Rust primitive type.
Compact(TypeDefCompact<T>)
A type using the [Compact
] encoding
BitSequence(TypeDefBitSequence<T>)
A type representing a sequence of bits.
Trait Implementations§
Source§impl<T: Form> Decode for TypeDef<T>where
TypeDefComposite<T>: Decode,
TypeDefVariant<T>: Decode,
TypeDefSequence<T>: Decode,
TypeDefArray<T>: Decode,
TypeDefTuple<T>: Decode,
TypeDefCompact<T>: Decode,
TypeDefBitSequence<T>: Decode,
impl<T: Form> Decode for TypeDef<T>where
TypeDefComposite<T>: Decode,
TypeDefVariant<T>: Decode,
TypeDefSequence<T>: Decode,
TypeDefArray<T>: Decode,
TypeDefTuple<T>: Decode,
TypeDefCompact<T>: Decode,
TypeDefBitSequence<T>: Decode,
Source§fn 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.
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
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. Read more
Source§impl<T: Form> Encode for TypeDef<T>where
TypeDefComposite<T>: Encode,
TypeDefVariant<T>: Encode,
TypeDefSequence<T>: Encode,
TypeDefArray<T>: Encode,
TypeDefTuple<T>: Encode,
TypeDefCompact<T>: Encode,
TypeDefBitSequence<T>: Encode,
impl<T: Form> Encode for TypeDef<T>where
TypeDefComposite<T>: Encode,
TypeDefVariant<T>: Encode,
TypeDefSequence<T>: Encode,
TypeDefArray<T>: Encode,
TypeDefTuple<T>: Encode,
TypeDefCompact<T>: Encode,
TypeDefBitSequence<T>: Encode,
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn 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.
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl<F: Form> From<TypeDefArray<F>> for TypeDef<F>
impl<F: Form> From<TypeDefArray<F>> for TypeDef<F>
Source§fn from(x: TypeDefArray<F>) -> Self
fn from(x: TypeDefArray<F>) -> Self
Converts to this type from the input type.
Source§impl<F: Form> From<TypeDefBitSequence<F>> for TypeDef<F>
impl<F: Form> From<TypeDefBitSequence<F>> for TypeDef<F>
Source§fn from(x: TypeDefBitSequence<F>) -> Self
fn from(x: TypeDefBitSequence<F>) -> Self
Converts to this type from the input type.
Source§impl<F: Form> From<TypeDefCompact<F>> for TypeDef<F>
impl<F: Form> From<TypeDefCompact<F>> for TypeDef<F>
Source§fn from(x: TypeDefCompact<F>) -> Self
fn from(x: TypeDefCompact<F>) -> Self
Converts to this type from the input type.
Source§impl<F: Form> From<TypeDefComposite<F>> for TypeDef<F>
impl<F: Form> From<TypeDefComposite<F>> for TypeDef<F>
Source§fn from(x: TypeDefComposite<F>) -> Self
fn from(x: TypeDefComposite<F>) -> Self
Converts to this type from the input type.
Source§impl<F: Form> From<TypeDefPrimitive> for TypeDef<F>
impl<F: Form> From<TypeDefPrimitive> for TypeDef<F>
Source§fn from(x: TypeDefPrimitive) -> Self
fn from(x: TypeDefPrimitive) -> Self
Converts to this type from the input type.
Source§impl<F: Form> From<TypeDefSequence<F>> for TypeDef<F>
impl<F: Form> From<TypeDefSequence<F>> for TypeDef<F>
Source§fn from(x: TypeDefSequence<F>) -> Self
fn from(x: TypeDefSequence<F>) -> Self
Converts to this type from the input type.
Source§impl<F: Form> From<TypeDefTuple<F>> for TypeDef<F>
impl<F: Form> From<TypeDefTuple<F>> for TypeDef<F>
Source§fn from(x: TypeDefTuple<F>) -> Self
fn from(x: TypeDefTuple<F>) -> Self
Converts to this type from the input type.
Source§impl<F: Form> From<TypeDefVariant<F>> for TypeDef<F>
impl<F: Form> From<TypeDefVariant<F>> for TypeDef<F>
Source§fn from(x: TypeDefVariant<F>) -> Self
fn from(x: TypeDefVariant<F>) -> Self
Converts to this type from the input type.
Source§impl IntoPortable for TypeDef
impl IntoPortable for TypeDef
Source§type Output = TypeDef<PortableForm>
type Output = TypeDef<PortableForm>
The portable version of
Self
.Source§fn into_portable(self, registry: &mut Registry) -> Self::Output
fn into_portable(self, registry: &mut Registry) -> Self::Output
Convert
self
to the portable form by using the registry for caching.Source§impl<T: Ord + Form> Ord for TypeDef<T>
impl<T: Ord + Form> Ord for TypeDef<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd + Form> PartialOrd for TypeDef<T>
impl<T: PartialOrd + Form> PartialOrd for TypeDef<T>
impl<T: Form> EncodeLike for TypeDef<T>where
TypeDefComposite<T>: Encode,
TypeDefVariant<T>: Encode,
TypeDefSequence<T>: Encode,
TypeDefArray<T>: Encode,
TypeDefTuple<T>: Encode,
TypeDefCompact<T>: Encode,
TypeDefBitSequence<T>: Encode,
impl<T: Eq + Form> Eq for TypeDef<T>
impl<T: Form> StructuralPartialEq for TypeDef<T>
Auto Trait Implementations§
impl<T> Freeze for TypeDef<T>
impl<T> RefUnwindSafe for TypeDef<T>
impl<T> Send for TypeDef<T>
impl<T> Sync for TypeDef<T>
impl<T> Unpin for TypeDef<T>
impl<T> UnwindSafe for TypeDef<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more