pub struct AssetBundle {
pub header: BundleHeader,
pub blocks: Vec<CompressionBlock>,
pub nodes: Vec<DirectoryNode>,
pub files: Vec<BundleFileInfo>,
pub assets: Vec<SerializedFile>,
/* private fields */
}
Expand description
A Unity AssetBundle
This structure represents a complete Unity AssetBundle with all its metadata, compression information, and contained assets.
Fields§
§header: BundleHeader
Bundle header
blocks: Vec<CompressionBlock>
Compression blocks
nodes: Vec<DirectoryNode>
Directory nodes
files: Vec<BundleFileInfo>
File information
assets: Vec<SerializedFile>
Contained assets
Implementations§
Source§impl AssetBundle
impl AssetBundle
Sourcepub fn new(header: BundleHeader, data: Vec<u8>) -> AssetBundle
pub fn new(header: BundleHeader, data: Vec<u8>) -> AssetBundle
Create a new AssetBundle
Sourcepub fn is_compressed(&self) -> bool
pub fn is_compressed(&self) -> bool
Check if the bundle is compressed
Sourcepub fn file_count(&self) -> usize
pub fn file_count(&self) -> usize
Get the number of files in the bundle
Sourcepub fn asset_count(&self) -> usize
pub fn asset_count(&self) -> usize
Get the number of assets in the bundle
Sourcepub fn find_file(&self, name: &str) -> Option<&BundleFileInfo>
pub fn find_file(&self, name: &str) -> Option<&BundleFileInfo>
Find a file by name
Sourcepub fn find_node(&self, name: &str) -> Option<&DirectoryNode>
pub fn find_node(&self, name: &str) -> Option<&DirectoryNode>
Find a node by name
Sourcepub fn file_names(&self) -> Vec<&str>
pub fn file_names(&self) -> Vec<&str>
Get all file names
Sourcepub fn node_names(&self) -> Vec<&str>
pub fn node_names(&self) -> Vec<&str>
Get all node names
Sourcepub fn extract_file_data(
&self,
file: &BundleFileInfo,
) -> Result<Vec<u8>, BinaryError>
pub fn extract_file_data( &self, file: &BundleFileInfo, ) -> Result<Vec<u8>, BinaryError>
Extract data for a specific file
Sourcepub fn extract_node_data(
&self,
node: &DirectoryNode,
) -> Result<Vec<u8>, BinaryError>
pub fn extract_node_data( &self, node: &DirectoryNode, ) -> Result<Vec<u8>, BinaryError>
Extract data for a specific node
Sourcepub fn statistics(&self) -> BundleStatistics
pub fn statistics(&self) -> BundleStatistics
Get bundle statistics
Sourcepub fn validate(&self) -> Result<(), BinaryError>
pub fn validate(&self) -> Result<(), BinaryError>
Validate bundle consistency
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AssetBundle
impl RefUnwindSafe for AssetBundle
impl Send for AssetBundle
impl Sync for AssetBundle
impl Unpin for AssetBundle
impl UnwindSafe for AssetBundle
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
Mutably borrows from an owned value. Read more
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>
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 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>
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