pub enum FieldType {
Show 16 variants
Boolean,
F32,
F64,
I16,
I32,
I64,
ColourRGB,
StringU8,
StringU16,
OptionalI16,
OptionalI32,
OptionalI64,
OptionalStringU8,
OptionalStringU16,
SequenceU16(Box<Definition>),
SequenceU32(Box<Definition>),
}Expand description
Supported data types for table fields.
This enum defines all field types that can be encoded/decoded from Total War database tables. Each variant corresponds to a specific binary representation in the game files.
§Basic Types
- Boolean: 1-byte boolean value
- Integers: Signed integers of various sizes (I16, I32, I64)
- Floats: Floating-point numbers (F32, F64)
- Strings: Length-prefixed strings with
u8oru16length markers
§Optional Types
Optional types use a 1-byte flag followed by the value if present:
- OptionalI16, OptionalI32, OptionalI64: Optional integers
- OptionalStringU8, OptionalStringU16: Optional strings
§Complex Types
- ColourRGB: 6-character hexadecimal RGB colour (e.g., “FF0000” for red)
- SequenceU16, SequenceU32: Arrays with
u16oru32length prefix
§Sequences
Sequence types contain a nested Definition that describes the structure of each
array element. The length prefix determines how many elements follow.
Variants§
Boolean
1-byte boolean value (0 = false, 1 = true).
F32
32-bit floating-point number.
F64
64-bit floating-point number.
I16
16-bit signed integer.
I32
32-bit signed integer.
I64
64-bit signed integer.
ColourRGB
RGB colour as a 6-character hexadecimal string (e.g., “FF0000”).
StringU8
UTF-8 encoded string with u16 length prefix (max 65535 bytes).
StringU16
UTF-16 encoded string with u16 length prefix (max 65535 characters).
OptionalI16
Optional 16-bit signed integer (1-byte flag + value if present).
OptionalI32
Optional 32-bit signed integer (1-byte flag + value if present).
OptionalI64
Optional 64-bit signed integer (1-byte flag + value if present).
OptionalStringU8
Optional UTF-8 encoded string (1-byte flag + u16 length prefix + string if present).
OptionalStringU16
Optional UTF-16 encoded string (1-byte flag + u16 length prefix + string if present).
SequenceU16(Box<Definition>)
Array with u16 element count followed by elements matching the nested definition.
SequenceU32(Box<Definition>)
Array with u32 element count followed by elements matching the nested definition.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FieldType
impl<'de> Deserialize<'de> for FieldType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&DecodedData> for FieldType
Implementation of From<&RawDefinition> for `Definition.
impl From<&DecodedData> for FieldType
Implementation of From<&RawDefinition> for `Definition.
Source§fn from(data: &DecodedData) -> Self
fn from(data: &DecodedData) -> Self
impl Eq for FieldType
impl StructuralPartialEq for FieldType
Auto Trait Implementations§
impl Freeze for FieldType
impl RefUnwindSafe for FieldType
impl Send for FieldType
impl Sync for FieldType
impl Unpin for FieldType
impl UnsafeUnpin for FieldType
impl UnwindSafe for FieldType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.