TypeTreeSerializer

Struct TypeTreeSerializer 

Source
pub struct TypeTreeSerializer<'a> { /* private fields */ }
Expand description

TypeTree serializer

This struct provides methods for serializing and deserializing Unity objects using TypeTree structure information.

Implementations§

Source§

impl<'a> TypeTreeSerializer<'a>

Source

pub fn new(tree: &'a TypeTree) -> Self

Create a new serializer with a TypeTree

Source

pub fn parse_object( &self, reader: &mut BinaryReader<'_>, ) -> Result<IndexMap<String, UnityValue>>

Parse object data using the TypeTree structure

Source

pub fn parse_object_with_ref_types( &self, reader: &mut BinaryReader<'_>, ref_types: &'a [SerializedType], ) -> Result<IndexMap<String, UnityValue>>

Source

pub fn parse_object_detailed( &self, reader: &mut BinaryReader<'_>, options: TypeTreeParseOptions, ) -> Result<TypeTreeParseOutput>

Source

pub fn parse_object_detailed_with_ref_types( &self, reader: &mut BinaryReader<'_>, options: TypeTreeParseOptions, ref_types: &'a [SerializedType], ) -> Result<TypeTreeParseOutput>

Source

pub fn parse_object_prefix_detailed( &self, reader: &mut BinaryReader<'_>, options: TypeTreeParseOptions, root_children: usize, ) -> Result<TypeTreeParseOutput>

Parse only the first root_children fields of the root node.

This enables UnityPy-like fast paths such as peek_name() where we only need a small prefix of the TypeTree to reach m_Name.

Source

pub fn parse_object_prefix_detailed_with_ref_types( &self, reader: &mut BinaryReader<'_>, options: TypeTreeParseOptions, root_children: usize, ref_types: &'a [SerializedType], ) -> Result<TypeTreeParseOutput>

Source

pub fn scan_pptrs( &self, reader: &mut BinaryReader<'_>, ) -> Result<PPtrScanResult>

Scan TypeTree-based object bytes and collect any encountered PPtr references without allocating a full UnityValue tree.

Source

pub fn scan_pptrs_with_ref_types( &self, reader: &mut BinaryReader<'_>, ref_types: Option<&[SerializedType]>, ) -> Result<PPtrScanResult>

Scan TypeTree-based object bytes and collect any encountered PPtr references, using file-level ref_types to best-effort traverse managed reference payloads.

Source

pub fn serialize_object( &self, data: &IndexMap<String, UnityValue>, ) -> Result<Vec<u8>>

Serialize object data using the TypeTree structure

Source

pub fn tree(&self) -> &TypeTree

Get the TypeTree being used

Source

pub fn estimate_size(&self, data: &IndexMap<String, UnityValue>) -> usize

Estimate serialized size

Auto Trait Implementations§

§

impl<'a> Freeze for TypeTreeSerializer<'a>

§

impl<'a> RefUnwindSafe for TypeTreeSerializer<'a>

§

impl<'a> Send for TypeTreeSerializer<'a>

§

impl<'a> Sync for TypeTreeSerializer<'a>

§

impl<'a> Unpin for TypeTreeSerializer<'a>

§

impl<'a> UnwindSafe for TypeTreeSerializer<'a>

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.