[][src]Struct veriform_derive::field::Attrs

pub(crate) struct Attrs {
    tag: u64,
    wire_type: Ident,
    critical: bool,
    size: Option<usize>,
    min: Option<usize>,
    max: Option<usize>,
}

Parsed #[field(...)] attribute.

When deriving the Message trait, every enum variant or field of a struct MUST be tagged as a field.

Example

This example is not tested
#[derive(Message, Debug, Eq, PartialEq)]
pub struct ExampleMessageA {
    #[field(tag = 0, wire_type = "uint64", critical = true)]
    pub uint64_field: u64,

    #[field(tag = 1, wire_type = "sint64")]
    pub sint64_field: i64,

    #[field(tag = 2, wire_type = "sequence", critical = true, max = 8)]
    pub msg_sequence_field: Vec<ExampleMessageB>,
}

Fields

tag: u64

Tag which identifies the field

wire_type: Ident

Wire type of the field. See WireType for the available type names.

critical: bool

Is this field critical?

size: Option<usize>

Size of a fixed-size field

min: Option<usize>

Minimum size of a variable-sized field

max: Option<usize>

Maximum size of a variable-sized field

Implementations

impl Attrs[src]

pub fn tag(&self) -> u64[src]

Get the field identifier tag

pub fn wire_type(&self) -> WireType[src]

Parse the wire type ident

pub fn is_critical(&self) -> bool[src]

Is this field critical?

Trait Implementations

impl Debug for Attrs[src]

impl FromField for Attrs[src]

impl FromVariant for Attrs[src]

Auto Trait Implementations

impl !RefUnwindSafe for Attrs

impl !Send for Attrs

impl !Sync for Attrs

impl Unpin for Attrs

impl UnwindSafe for Attrs

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.