Enum FieldValue

Source
pub enum FieldValue {
Show 16 variants Byte(u8), Char(i8), Word(u16), Short(i16), DWord(u32), Int(i32), DWord64(u64), Int64(i64), Float(f32), Double(f64), String(String), ResRef(String), LocString(LocString), Void(Vec<u8>), Struct(Struct), List(List),
}
Expand description

GFF Field value (value node inside a GFF Struct)

Variants§

§

Byte(u8)

Unsigned 8-bit integer

§

Char(i8)

Signed 8-bit integer

§

Word(u16)

Unsigned 16-bit integer

§

Short(i16)

Signed 16-bit integer

§

DWord(u32)

Unsigned 32-bit integer

§

Int(i32)

Signed 32-bit integer

§

DWord64(u64)

Unsigned 64-bit integer

§

Int64(i64)

Signed 64-bit integer

§

Float(f32)

32-bit floating point

§

Double(f64)

64-bit floating point

§

String(String)

String, with a length stored as a 32-bit unsigned integer

§

ResRef(String)

String, with a length stored as a 8-bit unsigned integer

§

LocString(LocString)

Localized strung

§

Void(Vec<u8>)

Raw data

§

Struct(Struct)

Struct containing other Fields

§

List(List)

List of Structs

Implementations§

Source§

impl FieldValue

Source

pub fn get_type_str(&self) -> &'static str

Returns a str representation of the stored type

Source

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

Serializes this field to human-readable text

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

pub fn unwrap_byte(&self) -> u8

Unwraps stored byte value, panics if the field is not a byte

Source

pub fn unwrap_char(&self) -> i8

Unwraps stored char value, panics if the field is not a char

Source

pub fn unwrap_word(&self) -> u16

Unwraps stored word value, panics if the field is not a word

Source

pub fn unwrap_short(&self) -> i16

Unwraps stored short value, panics if the field is not a short

Source

pub fn unwrap_dword(&self) -> u32

Unwraps stored dword value, panics if the field is not a dword

Source

pub fn unwrap_int(&self) -> i32

Unwraps stored int value, panics if the field is not a int

Source

pub fn unwrap_dword64(&self) -> u64

Unwraps stored dword64 value, panics if the field is not a dword64

Source

pub fn unwrap_int64(&self) -> i64

Unwraps stored int64 value, panics if the field is not a int64

Source

pub fn unwrap_float(&self) -> f32

Unwraps stored float value, panics if the field is not a float

Source

pub fn unwrap_double(&self) -> f64

Unwraps stored double value, panics if the field is not a double

Source

pub fn unwrap_string(&self) -> &String

Unwraps stored string value, panics if the field is not a string

Source

pub fn unwrap_resref(&self) -> &String

Unwraps stored resref value, panics if the field is not a resref

Source

pub fn unwrap_locstring(&self) -> &LocString

Unwraps stored locstring value, panics if the field is not a locstring

Source

pub fn unwrap_void(&self) -> &Vec<u8>

Unwraps stored void value, panics if the field is not a void

Source

pub fn unwrap_struct(&self) -> &Struct

Unwraps stored struct value, panics if the field is not a struct

Source

pub fn unwrap_list(&self) -> &Vec<Struct>

Unwraps stored list value, panics if the field is not a list

Trait Implementations§

Source§

impl Debug for FieldValue

Source§

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

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

impl<'de> Deserialize<'de> for FieldValue

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 FieldValue

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§

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>,