Skip to main content

NodeType

Enum NodeType 

Source
pub enum NodeType {
Show 39 variants Invalid, Bool(BoolNode), I8(i8), I16(i16), I32(I32Node), I64(i64), U8(u8), U16(u16), U32(U32Node), U64(u64), F32(F32Node), F64(f64), Coord2d(Coordinates2DNode), Coord3d(Coordinates3DNode), Utf16(String), Ascii(String), Angle(i16), Unknown21(u32), Unknown23(u8), Unknown24(u16), Unknown25(u32), Unknown26(Vec<u8>), BoolArray(Vec<bool>), I8Array(Vec<u8>), I16Array(Vec<i16>), I32Array(VecI32Node), I64Array(Vec<i64>), U8Array(Vec<u8>), U16Array(Vec<u16>), U32Array(VecU32Node), U64Array(Vec<u64>), F32Array(Vec<f32>), F64Array(Vec<f64>), Coord2dArray(Vec<Coordinates2DNode>), Coord3dArray(Vec<Coordinates3DNode>), Utf16Array(Vec<String>), AsciiArray(Vec<String>), AngleArray(Vec<i16>), Record(Box<RecordNode>),
}
Expand description

Represents all possible node types in an ESF file.

ESF files use a tagged union approach where each node in the binary format starts with a type marker byte that identifies what kind of data follows. This enum mirrors that structure.

§Categories

  • Primitive nodes: Single values (bool, integers, floats, strings)
  • Optimized nodes: Primitives with compact encoding tracking (BoolNode, I32Node, etc.)
  • Complex nodes: Structured data like coordinates
  • Array nodes: Collections of same-typed values
  • Record nodes: Container nodes with named children
  • Unknown nodes: Undocumented types preserved for round-trip fidelity

Note: Some type information was originally extracted from ESFEdit.

Variants§

§

Invalid

Invalid/uninitialized node. Used as a placeholder; encountering this during parsing or encoding indicates an error.

§

Bool(BoolNode)

Boolean value with optimization tracking.

§

I8(i8)

Signed 8-bit integer.

§

I16(i16)

Signed 16-bit integer.

§

I32(I32Node)

Signed 32-bit integer with optimization tracking.

§

I64(i64)

Signed 64-bit integer.

§

U8(u8)

Unsigned 8-bit integer.

§

U16(u16)

Unsigned 16-bit integer.

§

U32(U32Node)

Unsigned 32-bit integer with optimization tracking.

§

U64(u64)

Unsigned 64-bit integer.

§

F32(F32Node)

32-bit floating point with optimization tracking.

§

F64(f64)

64-bit floating point.

§

Coord2d(Coordinates2DNode)

2D coordinate (x, y as f32).

§

Coord3d(Coordinates3DNode)

3D coordinate (x, y, z as f32).

§

Utf16(String)

UTF-16 encoded string (stored as index, resolved during decode).

§

Ascii(String)

ASCII/UTF-8 encoded string (stored as index, resolved during decode).

§

Angle(i16)

Angle value stored as i16.

§

Unknown21(u32)

Unknown type 0x21 storing a u32 value.

§

Unknown23(u8)

Unknown type 0x23 storing a u8 value.

§

Unknown24(u16)

Unknown type 0x24 storing a u16 value.

§

Unknown25(u32)

Unknown type 0x25 storing a u32 value.

§

Unknown26(Vec<u8>)

Unknown type 0x26 with variable-length data (Three Kingdoms DLC).

§

BoolArray(Vec<bool>)

Array of boolean values.

§

I8Array(Vec<u8>)

Array of i8 values (stored as u8 for efficiency).

§

I16Array(Vec<i16>)

Array of i16 values.

§

I32Array(VecI32Node)

Array of i32 values with optimization tracking.

§

I64Array(Vec<i64>)

Array of i64 values.

§

U8Array(Vec<u8>)

Array of u8 values (raw bytes).

§

U16Array(Vec<u16>)

Array of u16 values.

§

U32Array(VecU32Node)

Array of u32 values with optimization tracking.

§

U64Array(Vec<u64>)

Array of u64 values.

§

F32Array(Vec<f32>)

Array of f32 values.

§

F64Array(Vec<f64>)

Array of f64 values.

§

Coord2dArray(Vec<Coordinates2DNode>)

Array of 2D coordinates.

§

Coord3dArray(Vec<Coordinates3DNode>)

Array of 3D coordinates.

§

Utf16Array(Vec<String>)

Array of UTF-16 strings.

§

AsciiArray(Vec<String>)

Array of ASCII strings.

§

AngleArray(Vec<i16>)

Array of angle values.

§

Record(Box<RecordNode>)

Record node - a named container holding child nodes. Records form the hierarchical structure of ESF files.

Implementations§

Source§

impl NodeType

Source

pub fn clone_without_children(&self) -> Self

Creates a copy of a node without its children (for record nodes).

For record nodes, this creates a new record with the same name, flags, and version but with an empty children list. For all other node types, this is equivalent to clone().

Useful for building modified node trees while preserving the structure.

Trait Implementations§

Source§

impl Clone for NodeType

Source§

fn clone(&self) -> NodeType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeType

Source§

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

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

impl Default for NodeType

Source§

fn default() -> NodeType

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for NodeType

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 PartialEq for NodeType

Source§

fn eq(&self, other: &NodeType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for NodeType

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

impl StructuralPartialEq for NodeType

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,