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: u32Struct 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
impl Struct
pub fn is_empty(&self) -> bool
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut Field>
pub fn get_mut(&mut self, index: usize) -> Option<&mut Field>
Returns the nth Field in this Struct
Sourcepub fn find_field(&self, label: &str) -> Option<&Field>
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)
Sourcepub fn find(&self, label: &str) -> Option<&FieldValue>
pub fn find(&self, label: &str) -> Option<&FieldValue>
Finds the first FieldValue matching the given label
Sourcepub fn find_field_mut(&mut self, label: &str) -> Option<&mut Field>
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)
Sourcepub fn find_mut(&mut self, label: &str) -> Option<&mut FieldValue>
pub fn find_mut(&mut self, label: &str) -> Option<&mut FieldValue>
Finds the first FieldValue matching the given label
Sourcepub fn find_all(&self, label: &str) -> Vec<&FieldValue>
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)
Sourcepub fn find_all_mut(&mut self, label: &str) -> Vec<&mut FieldValue>
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)
Sourcepub fn to_string_pretty(&self, child_indent: &str) -> String
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