Struct Struct

Source
pub struct Struct {
    pub id: u32,
    pub fields: Vec<Field>,
}
Expand description

GFF Struct (Key/Value container)

Contains a list of Field, with a label string used as a key Note: in some rare cases, there can be multiple fields with the same label.

Fields§

§id: u32

Struct ID

This is sometimes used as the Struct index in a List, or for identifying a specific Struct template

§fields: Vec<Field>

List of fields in this struct

Note: in some rare cases, there can be multiple fields with the same label.

Implementations§

Source§

impl Struct

Source

pub fn len(&self) -> usize

Number of fields in this Struct

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, index: usize) -> Option<&Field>

Returns the nth Field in this Struct

Source

pub fn get_mut(&mut self, index: usize) -> Option<&mut Field>

Returns the nth Field in this Struct

Source

pub fn find_field(&self, label: &str) -> Option<&Field>

Finds the first Field matching the given label

Note: find is more useful for most use cases)

Source

pub fn find(&self, label: &str) -> Option<&FieldValue>

Finds the first FieldValue matching the given label

Source

pub fn find_field_mut(&mut self, label: &str) -> Option<&mut Field>

Finds the first Field matching the given label

Note: find_mut is more useful for most use cases)

Source

pub fn find_mut(&mut self, label: &str) -> Option<&mut FieldValue>

Finds the first FieldValue matching the given label

Source

pub fn find_all(&self, label: &str) -> Vec<&FieldValue>

Accumulates all FieldValue that matches the given label (in most cases there’s only one field for each label)

Source

pub fn find_all_mut(&mut self, label: &str) -> Vec<&mut FieldValue>

Accumulates all FieldValue that matches the given label (in most cases there’s only one field for each label)

Source

pub fn to_string_pretty(&self, child_indent: &str) -> String

Serializes this struct to human-readable text

§Args:
  • child_indent: prepend this str to each line after the first one

Trait Implementations§

Source§

impl Debug for Struct

Source§

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

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

impl<'de> Deserialize<'de> for Struct

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Struct

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

Auto Trait Implementations§

§

impl Freeze for Struct

§

impl RefUnwindSafe for Struct

§

impl !Send for Struct

§

impl !Sync for Struct

§

impl Unpin for Struct

§

impl UnwindSafe for Struct

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,