[−][src]Struct veriform_derive::field::Attrs
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]
fn from_field(__field: &Field) -> Result<Self>
[src]
impl FromVariant for Attrs
[src]
fn from_variant(__variant: &Variant) -> Result<Self>
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,