pub struct AssetBundle {
pub header: BundleHeader,
pub blocks: Vec<CompressionBlock>,
pub nodes: Vec<DirectoryNode>,
pub files: Vec<BundleFileInfo>,
pub assets: Vec<Asset>,
pub asset_names: Vec<String>,
/* 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: BundleHeaderBundle header
blocks: Vec<CompressionBlock>Compression blocks
nodes: Vec<DirectoryNode>Directory nodes
files: Vec<BundleFileInfo>File information
assets: Vec<Asset>Contained assets
asset_names: Vec<String>Asset file names within the bundle (aligned with assets indices).
Implementations§
Source§impl AssetBundle
impl AssetBundle
Sourcepub fn new(header: BundleHeader, data: Vec<u8>) -> Self
pub fn new(header: BundleHeader, data: Vec<u8>) -> Self
Create a new AssetBundle
Sourcepub fn data_checked(&self) -> Result<&[u8]>
pub fn data_checked(&self) -> Result<&[u8]>
Get the decompressed bundle data, decompressing UnityFS blocks on demand.
Sourcepub fn data(&self) -> &[u8] ⓘ
pub fn data(&self) -> &[u8] ⓘ
Get the raw bundle data if already decompressed, otherwise returns an empty slice.
Sourcepub fn data_arc(&self) -> Result<Arc<[u8]>>
pub fn data_arc(&self) -> Result<Arc<[u8]>>
Get a shared reference to the decompressed bundle data, decompressing on demand.
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>>
pub fn extract_file_data(&self, file: &BundleFileInfo) -> Result<Vec<u8>>
Extract data for a specific file
pub fn extract_file_slice(&self, file: &BundleFileInfo) -> Result<&[u8]>
Sourcepub fn extract_node_data(&self, node: &DirectoryNode) -> Result<Vec<u8>>
pub fn extract_node_data(&self, node: &DirectoryNode) -> Result<Vec<u8>>
Extract data for a specific node
pub fn extract_node_slice(&self, node: &DirectoryNode) -> Result<&[u8]>
Sourcepub fn statistics(&self) -> BundleStatistics
pub fn statistics(&self) -> BundleStatistics
Get bundle statistics