Enum EncodableField

Source
pub enum EncodableField<'a> {
    Primitive(EncodablePrimitive<'a>),
    Struct(Vec<EncodableField<'a>>),
}
Expand description

The EncodableField enum defines encodable fields, which may be a primitive or struct.

Each EncodableField represents either a primitive value or a collection of values (a struct). The encoding process for EncodableField supports nesting, allowing for complex hierarchical data structures to be serialized.

Variants§

§

Primitive(EncodablePrimitive<'a>)

Represents a primitive value

For the full supported list please see EncodablePrimitive

§

Struct(Vec<EncodableField<'a>>)

Represents a struct like field structure.

Note that this is a recursive enum type.

Implementations§

Source§

impl EncodableField<'_>

Source

pub fn encode(&self, dst: &mut [u8], offset: usize) -> Result<usize, Error>

The encode method serializes a field into the destination buffer dst, starting at the provided offset. If the field is a structure, it recursively encodes each contained field. If the buffer is too small or encoding fails, the method returns an error.

Trait Implementations§

Source§

impl<'a> Debug for EncodableField<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<Seq0255<'a, Inner<'a, false, 1, 1, 255>>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, B0255<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, Inner<'a, false, 1, 2, { u16::MAX as usize }>>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, B064K<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, Inner<'a, false, 1, 3, { 2_usize.pow(24) - 1 }>>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, B016M<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, Inner<'a, true, 32, 0, 0>>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, U256<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, Inner<'a, true, 64, 0, 0>>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, Signature<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, U24>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, U24>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, bool>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, bool>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, u16>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, u16>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, u32>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, u32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, u64>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, u64>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq0255<'a, u8>> for EncodableField<'a>

Source§

fn from(v: Seq0255<'_, u8>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, Inner<'a, false, 1, 1, 255>>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, B0255<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, Inner<'a, false, 1, 2, { u16::MAX as usize }>>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, B064K<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, Inner<'a, false, 1, 3, { 2_usize.pow(24) - 1 }>>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, B016M<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, Inner<'a, true, 32, 0, 0>>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, U256<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, Inner<'a, true, 64, 0, 0>>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, Signature<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, U24>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, U24>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, bool>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, bool>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, u16>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, u16>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, u32>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, u32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, u64>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, u64>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Seq064K<'a, u8>> for EncodableField<'a>

Source§

fn from(v: Seq064K<'a, u8>) -> Self

Converts to this type from the input type.
Source§

impl From<Slice> for EncodableField<'_>

Source§

fn from(_v: Slice) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, Inner<'a, false, 1, 1, 255>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, B0255<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, Inner<'a, false, 1, 2, { u16::MAX as usize }>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, B064K<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, Inner<'a, false, 1, 3, { 2_usize.pow(24) - 1 }>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, B016M<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, Inner<'a, true, 32, 0, 0>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, U256<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, Inner<'a, true, 64, 0, 0>>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, Signature<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, U24>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, U24>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, bool>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, bool>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, u16>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, u16>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, u32>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, u32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, u64>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, u64>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sv2Option<'a, u8>> for EncodableField<'a>

Source§

fn from(v: Sv2Option<'_, u8>) -> Self

Converts to this type from the input type.
Source§

impl From<U24> for EncodableField<'_>

Source§

fn from(v: U24) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for EncodableField<'_>

Source§

fn from(_v: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for EncodableField<'_>

Source§

fn from(v: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for EncodableField<'_>

Source§

fn from(v: f32) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for EncodableField<'_>

Source§

fn from(v: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for EncodableField<'_>

Source§

fn from(v: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for EncodableField<'_>

Source§

fn from(v: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for EncodableField<'_>

Source§

fn from(v: u8) -> Self

Converts to this type from the input type.
Source§

impl GetSize for EncodableField<'_>

Source§

fn get_size(&self) -> usize

get_size returns total size of the type in bytes.
Source§

impl<'a> TryFrom<EncodableField<'a>> for B0255<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for B032<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for B064K<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for B016M<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for U256<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for U32AsRef<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for Signature<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for U24

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for bool

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for f32

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for u16

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for u32

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for u64

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<EncodableField<'a>> for u8

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: EncodableField<'a>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for EncodableField<'a>

§

impl<'a> RefUnwindSafe for EncodableField<'a>

§

impl<'a> Send for EncodableField<'a>

§

impl<'a> Sync for EncodableField<'a>

§

impl<'a> Unpin for EncodableField<'a>

§

impl<'a> !UnwindSafe for EncodableField<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<'a, T> Encodable for T
where T: Into<EncodableField<'a>>,

Source§

fn to_bytes(self, dst: &mut [u8]) -> Result<usize, Error>

Encodes the object into the provided byte slice. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.