pub struct FieldDef {
pub name: String,
pub id: u16,
pub type_name: String,
pub offset: usize,
pub presence: Presence,
pub semantic_type: Option<String>,
pub description: Option<String>,
pub since_version: Option<u16>,
pub deprecated: Option<u16>,
pub value_ref: Option<String>,
pub encoded_length: usize,
}Expand description
Field definition within a message or group.
Fields§
§name: StringField name.
id: u16Field ID (tag).
type_name: StringType name (references a type definition).
offset: usizeOffset within the block.
presence: PresenceField presence.
semantic_type: Option<String>Semantic type.
description: Option<String>Description.
since_version: Option<u16>Since version.
deprecated: Option<u16>Deprecated since version.
value_ref: Option<String>Constant value (if presence is Constant).
encoded_length: usizeEncoded length in bytes (resolved from type).
Implementations§
Source§impl FieldDef
impl FieldDef
Sourcepub fn new(name: String, id: u16, type_name: String, offset: usize) -> Self
pub fn new(name: String, id: u16, type_name: String, offset: usize) -> Self
Creates a new field definition.
Sourcepub fn is_optional(&self) -> bool
pub fn is_optional(&self) -> bool
Returns true if the field is optional.
Sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Returns true if the field has a constant value.
Sourcepub fn end_offset(&self) -> usize
pub fn end_offset(&self) -> usize
Returns the end offset (offset + length).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FieldDef
impl RefUnwindSafe for FieldDef
impl Send for FieldDef
impl Sync for FieldDef
impl Unpin for FieldDef
impl UnwindSafe for FieldDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more