pub struct PacketScope<'d> {
    pub all_fields: HashMap<String, &'d Field>,
    pub all_constraints: HashMap<String, &'d Constraint>,
    /* private fields */
}
Expand description

Gather information about a Packet, Struct, or Group declaration.

Fields§

§all_fields: HashMap<String, &'d Field>§all_constraints: HashMap<String, &'d Constraint>

Implementations§

source§

impl<'d> PacketScope<'d>

source

pub fn iter_fields(&self) -> impl Iterator<Item = &'d Field>

Iterate over the packet’s fields.

source

pub fn get_packet_field(&self, id: &str) -> Option<&Field>

Lookup a field by name. This will also find the special _payload_ and _body_ fields.

source

pub fn get_payload_field(&self) -> Option<&Field>

Find the payload or body field, if any.

source

pub fn get_array_size_field(&self, id: &str) -> Option<&Field>

Lookup the size field for an array field.

source

pub fn get_payload_size_field(&self) -> Option<&Field>

Find the size field corresponding to the payload or body field of this packet.

Trait Implementations§

source§

impl<'d> Debug for PacketScope<'d>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'d> RefUnwindSafe for PacketScope<'d>

§

impl<'d> Send for PacketScope<'d>

§

impl<'d> Sync for PacketScope<'d>

§

impl<'d> Unpin for PacketScope<'d>

§

impl<'d> UnwindSafe for PacketScope<'d>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.