pub struct SerializedFile {
pub header: SerializedFileHeader,
pub unity_version: String,
pub target_platform: i32,
pub enable_type_tree: bool,
pub type_tree_registry: Option<Arc<dyn TypeTreeRegistry>>,
pub types: Vec<SerializedType>,
pub big_id_enabled: bool,
pub objects: Vec<ObjectInfo>,
pub script_types: Vec<LocalSerializedObjectIdentifier>,
pub externals: Vec<FileIdentifier>,
pub ref_types: Vec<SerializedType>,
pub user_information: String,
/* private fields */
}Expand description
Complete SerializedFile structure
This structure represents a complete Unity SerializedFile with all its metadata, type information, and object data.
Fields§
§header: SerializedFileHeaderFile header
unity_version: StringUnity version string
target_platform: i32Target platform
enable_type_tree: boolWhether type tree is enabled
type_tree_registry: Option<Arc<dyn TypeTreeRegistry>>Optional external TypeTree registry for stripped files (best-effort).
types: Vec<SerializedType>Type information
big_id_enabled: boolWhether big IDs are enabled
objects: Vec<ObjectInfo>Object information
script_types: Vec<LocalSerializedObjectIdentifier>Script types
externals: Vec<FileIdentifier>External file references
ref_types: Vec<SerializedType>Reference types
user_information: StringUser information
Implementations§
Source§impl SerializedFile
impl SerializedFile
pub fn set_type_tree_registry( &mut self, registry: Option<Arc<dyn TypeTreeRegistry>>, )
Get the backing shared buffer for this file’s bytes.
Sourcepub fn data_arc(&self) -> Arc<[u8]>
pub fn data_arc(&self) -> Arc<[u8]>
Get the backing shared buffer for this file’s bytes.
Note: for embedded files (e.g. files inside a decompressed bundle buffer), this is the
shared backing buffer and may be larger than self.data().
If the backing storage is a memory map, this method currently allocates and copies into
an Arc<[u8]> for compatibility; prefer data_shared() for zero-copy access.
Sourcepub fn data_base_offset(&self) -> usize
pub fn data_base_offset(&self) -> usize
Base offset of this file within the backing shared buffer returned by data_arc().
Sourcepub fn data_identity_key(&self) -> (usize, usize, usize)
pub fn data_identity_key(&self) -> (usize, usize, usize)
A stable identity key for caches: (backing_ptr, base_offset, len).
Sourcepub fn object_bytes<'a>(
&'a self,
info: &ObjectInfo,
) -> Result<&'a [u8], BinaryError>
pub fn object_bytes<'a>( &'a self, info: &ObjectInfo, ) -> Result<&'a [u8], BinaryError>
Get the raw bytes for an object without requiring preloaded per-object buffers.
Sourcepub fn assetbundle_container_raw(
&self,
info: &ObjectInfo,
) -> Result<Vec<(String, i32, i64)>, BinaryError>
pub fn assetbundle_container_raw( &self, info: &ObjectInfo, ) -> Result<Vec<(String, i32, i64)>, BinaryError>
Best-effort raw parser for Unity AssetBundle (class id 142) m_Container.
This exists as a fallback when TypeTree is stripped/unavailable. The layout is version-dependent, so this function tries multiple 4-byte-aligned starting offsets and applies sanity checks.
Returns a list of (asset_path, file_id, path_id) tuples.
Sourcepub fn object_count(&self) -> usize
pub fn object_count(&self) -> usize
Get object count
Sourcepub fn type_count(&self) -> usize
pub fn type_count(&self) -> usize
Get type count
Sourcepub fn find_object(&self, path_id: i64) -> Option<&ObjectInfo>
pub fn find_object(&self, path_id: i64) -> Option<&ObjectInfo>
Find object by path ID
Sourcepub fn object_handles(&self) -> impl Iterator<Item = ObjectHandle<'_>>
pub fn object_handles(&self) -> impl Iterator<Item = ObjectHandle<'_>>
Iterate all objects as lightweight handles.
Sourcepub fn find_object_handle(&self, path_id: i64) -> Option<ObjectHandle<'_>>
pub fn find_object_handle(&self, path_id: i64) -> Option<ObjectHandle<'_>>
Find an object by path_id and return a lightweight handle.
Sourcepub fn find_type(&self, class_id: i32) -> Option<&SerializedType>
pub fn find_type(&self, class_id: i32) -> Option<&SerializedType>
Find type by class ID
Sourcepub fn objects_of_type(&self, type_id: i32) -> Vec<&ObjectInfo>
pub fn objects_of_type(&self, type_id: i32) -> Vec<&ObjectInfo>
Get all objects of a specific type
Sourcepub fn create_type_registry(&self) -> TypeRegistry
pub fn create_type_registry(&self) -> TypeRegistry
Create a type registry from this file
Sourcepub fn statistics(&self) -> FileStatistics
pub fn statistics(&self) -> FileStatistics
Get file statistics
Sourcepub fn validate(&self) -> Result<(), BinaryError>
pub fn validate(&self) -> Result<(), BinaryError>
Validate the entire file
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SerializedFile
impl !RefUnwindSafe for SerializedFile
impl Send for SerializedFile
impl Sync for SerializedFile
impl Unpin for SerializedFile
impl !UnwindSafe for SerializedFile
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> 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