pub enum AssetSource {
Path(PathBuf),
Packed {
offset: u64,
size: u64,
uncompressed_size: u64,
compression: CompressionKind,
},
}Expand description
Represents the physical source of an asset’s data.
This enum allows the asset system to transparently handle assets from two different contexts:
- In editor/development mode, assets are loaded directly from loose files on disk (
Path). - In release/standalone mode, assets are loaded from an optimized packfile (
Packed).
Pack format version: v2 added per-entry compression (compression,
uncompressed_size). v1 packs (without these fields) are no longer
supported on the read side; the loader bails on the header version
check before reaching this struct.
Variants§
Path(PathBuf)
The asset is a loose file on disk. The PathBuf points to the file.
Packed
The asset is located within a packfile.
Fields
§
offset: u64Byte offset from the start of the asset region (i.e. after
the 24-byte header) in data.pack.
§
uncompressed_size: u64Size of the asset after decompression. Equals size when
compression == CompressionKind::None.
§
compression: CompressionKindCompression scheme applied to the bytes between offset and
offset + size.
Trait Implementations§
Source§impl Clone for AssetSource
impl Clone for AssetSource
Source§fn clone(&self) -> AssetSource
fn clone(&self) -> AssetSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AssetSource
impl Debug for AssetSource
Source§impl<'de> Deserialize<'de> for AssetSource
impl<'de> Deserialize<'de> for AssetSource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AssetSource
impl RefUnwindSafe for AssetSource
impl Send for AssetSource
impl Sync for AssetSource
impl Unpin for AssetSource
impl UnsafeUnpin for AssetSource
impl UnwindSafe for AssetSource
Blanket Implementations§
Source§impl<T> AppLifecycle for Twhere
T: ?Sized,
impl<T> AppLifecycle for Twhere
T: ?Sized,
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