Skip to main content

AnySegment

Enum AnySegment 

Source
#[non_exhaustive]
pub enum AnySegment<'a> { PageComposition(PageCompositionSegment), RegionComposition(RegionCompositionSegment), ClutDefinition(ClutDefinitionSegment), ObjectData(ObjectDataSegment<'a>), DisplayDefinition(DisplayDefinitionSegment), DisparitySignalling(DisparitySignallingSegment), AlternativeClut(AlternativeClutSegment), EndOfDisplaySet(EndOfDisplaySetSegment), Stuffing(StuffingSegment<'a>), Unknown { segment_type: u8, page_id: u16, data: &'a [u8], }, }
Expand description

Every crate-implemented segment type, plus an Unknown fallthrough.

serde uses external tagging with camelCase variant keys.

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

PageComposition(PageCompositionSegment)

§

RegionComposition(RegionCompositionSegment)

§

ClutDefinition(ClutDefinitionSegment)

§

ObjectData(ObjectDataSegment<'a>)

§

DisplayDefinition(DisplayDefinitionSegment)

§

DisparitySignalling(DisparitySignallingSegment)

§

AlternativeClut(AlternativeClutSegment)

§

EndOfDisplaySet(EndOfDisplaySetSegment)

§

Stuffing(StuffingSegment<'a>)

§

Unknown

Segment with an unrecognized or unsupported segment_type; data is the segment body sans the 6-byte header (4 bytes of generic segment framing).

Fields

§segment_type: u8

The raw segment_type byte.

§page_id: u16

The page_id from the segment header.

§data: &'a [u8]

The segment body bytes (starting after the 4-byte sync_byte+segment_type+page_id+segment_length header).

Implementations§

Source§

impl<'a> AnySegment<'a>

Source

pub const DISPATCHED_SEGMENT_TYPES: &'static [u8]

Every segment_type the generated dispatcher routes.

Source

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

Diagnostic name of the contained segment — the type’s SegmentDef::NAME ("PAGE_COMPOSITION", "OBJECT_DATA", …); "UNKNOWN" for AnySegment::Unknown.

Trait Implementations§

Source§

impl<'a> Clone for AnySegment<'a>

Source§

fn clone(&self) -> AnySegment<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for AnySegment<'a>

Source§

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

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

impl<'a> Eq for AnySegment<'a>

Source§

impl<'a> From<AlternativeClutSegment> for AnySegment<'a>

Source§

fn from(s: AlternativeClutSegment) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<ClutDefinitionSegment> for AnySegment<'a>

Source§

fn from(s: ClutDefinitionSegment) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<DisparitySignallingSegment> for AnySegment<'a>

Source§

fn from(s: DisparitySignallingSegment) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<DisplayDefinitionSegment> for AnySegment<'a>

Source§

fn from(s: DisplayDefinitionSegment) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<EndOfDisplaySetSegment> for AnySegment<'a>

Source§

fn from(s: EndOfDisplaySetSegment) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<ObjectDataSegment<'a>> for AnySegment<'a>

Source§

fn from(s: ObjectDataSegment<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<PageCompositionSegment> for AnySegment<'a>

Source§

fn from(s: PageCompositionSegment) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<RegionCompositionSegment> for AnySegment<'a>

Source§

fn from(s: RegionCompositionSegment) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<StuffingSegment<'a>> for AnySegment<'a>

Source§

fn from(s: StuffingSegment<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> PartialEq for AnySegment<'a>

Source§

fn eq(&self, other: &AnySegment<'a>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> Serialize for AnySegment<'a>

Available on crate feature serde only.
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
Source§

impl<'a> StructuralPartialEq for AnySegment<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for AnySegment<'a>

§

impl<'a> RefUnwindSafe for AnySegment<'a>

§

impl<'a> Send for AnySegment<'a>

§

impl<'a> Sync for AnySegment<'a>

§

impl<'a> Unpin for AnySegment<'a>

§

impl<'a> UnsafeUnpin for AnySegment<'a>

§

impl<'a> UnwindSafe for AnySegment<'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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.