Skip to main content

AnyPayload

Enum AnyPayload 

Source
#[non_exhaustive]
pub enum AnyPayload<'a> {
Show 13 variants Bbframe(BbframePayload<'a>), AuxIq(AuxIqPayload<'a>), ArbitraryCells(ArbitraryCellsPayload<'a>), L1Current(L1CurrentPayload<'a>), L1Future(L1FuturePayload<'a>), P2Bias(P2BiasPayload), Timestamp(T2TimestampPayload), IndividualAddressing(IndividualAddressingPayload<'a>), FefNull(FefNullPayload), FefIq(FefIqPayload<'a>), FefComposite(FefCompositePayload), FefSubpart(FefSubPartPayload<'a>), Unknown { packet_type: u8, body: &'a [u8], },
}
Expand description

Every crate-implemented T2-MI payload, plus an Unknown fallthrough.

serde uses external tagging with camelCase variant keys. Variant names map 1:1 to the payload modules; see each module for the wire layout.

§Dispatch contract

Use AnyPayload::dispatch with the payload bytes (post-header, pre-CRC). See the module-level documentation for details.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Bbframe(BbframePayload<'a>)

§

AuxIq(AuxIqPayload<'a>)

§

ArbitraryCells(ArbitraryCellsPayload<'a>)

§

L1Current(L1CurrentPayload<'a>)

§

L1Future(L1FuturePayload<'a>)

§

P2Bias(P2BiasPayload)

§

Timestamp(T2TimestampPayload)

§

IndividualAddressing(IndividualAddressingPayload<'a>)

§

FefNull(FefNullPayload)

§

FefIq(FefIqPayload<'a>)

§

FefComposite(FefCompositePayload)

§

FefSubpart(FefSubPartPayload<'a>)

§

Unknown

Packet type with no typed implementation; body contains the raw payload bytes (post-header, pre-CRC).

Fields

§packet_type: u8

The raw packet_type byte.

§body: &'a [u8]

The raw payload bytes.

Implementations§

Source§

impl<'a> AnyPayload<'a>

Source

pub const DISPATCHED_TYPES: &'static [u8]

Every packet_type the generated dispatcher routes (excludes AnyPayload::Unknown).

Source

pub fn name(&self) -> &'static str

Diagnostic name of the contained payload — the type’s PayloadDef::NAME ("BBFRAME", "L1_CURRENT", …); "UNKNOWN" for AnyPayload::Unknown.

Source

pub fn dispatch( packet_type: u8, payload_bytes: &'a [u8], ) -> Option<Result<Self>>

Parse one payload by its packet_type.

payload_bytes must be the payload-only slice (bytes after the 6-byte T2-MI header, before the 4-byte CRC trailer).

Returns None when packet_type has no typed implementation (the caller turns that into AnyPayload::Unknown). Returns Some(Err) on a typed parse failure for a recognised type.

See the module-level documentation for the dispatch contract (payload-only bytes, header and CRC excluded).

Trait Implementations§

Source§

impl<'a> Debug for AnyPayload<'a>

Source§

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

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

impl<'a> From<ArbitraryCellsPayload<'a>> for AnyPayload<'a>

Source§

fn from(p: ArbitraryCellsPayload<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<AuxIqPayload<'a>> for AnyPayload<'a>

Source§

fn from(p: AuxIqPayload<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<BbframePayload<'a>> for AnyPayload<'a>

Source§

fn from(p: BbframePayload<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<FefCompositePayload> for AnyPayload<'a>

Source§

fn from(p: FefCompositePayload) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<FefIqPayload<'a>> for AnyPayload<'a>

Source§

fn from(p: FefIqPayload<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<FefNullPayload> for AnyPayload<'a>

Source§

fn from(p: FefNullPayload) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<FefSubPartPayload<'a>> for AnyPayload<'a>

Source§

fn from(p: FefSubPartPayload<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<IndividualAddressingPayload<'a>> for AnyPayload<'a>

Source§

fn from(p: IndividualAddressingPayload<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<L1CurrentPayload<'a>> for AnyPayload<'a>

Source§

fn from(p: L1CurrentPayload<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<L1FuturePayload<'a>> for AnyPayload<'a>

Source§

fn from(p: L1FuturePayload<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<P2BiasPayload> for AnyPayload<'a>

Source§

fn from(p: P2BiasPayload) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<T2TimestampPayload> for AnyPayload<'a>

Source§

fn from(p: T2TimestampPayload) -> Self

Converts to this type from the input type.
Source§

impl<'a> Serialize for AnyPayload<'a>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for AnyPayload<'a>

§

impl<'a> RefUnwindSafe for AnyPayload<'a>

§

impl<'a> Send for AnyPayload<'a>

§

impl<'a> Sync for AnyPayload<'a>

§

impl<'a> Unpin for AnyPayload<'a>

§

impl<'a> UnsafeUnpin for AnyPayload<'a>

§

impl<'a> UnwindSafe for AnyPayload<'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<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, 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.