pub struct Pack<'a> { /* private fields */ }Expand description
A pack’s files, read and unpacked: what a game lays in its bundle. A
file the pack keeps as it is borrows the pack’s bytes ('a); only a
compressed one is unpacked into memory of its own.
Implementations§
Source§impl<'a> Pack<'a>
impl<'a> Pack<'a>
Sourcepub fn open(bytes: &'a [u8], stamp: &str) -> Result<Self, PackError>
pub fn open(bytes: &'a [u8], stamp: &str) -> Result<Self, PackError>
The pack bytes, every file unpacked, if it is of this engine’s
VERSION, was baked with stamp, and holds together.
Sourcepub fn get(&self, path: &str) -> Option<&[u8]>
pub fn get(&self, path: &str) -> Option<&[u8]>
The bytes of the file at path, unpacked, if the pack has it.
Sourcepub fn into_owned(self) -> Pack<'static>
pub fn into_owned(self) -> Pack<'static>
The pack, every file in memory of its own: for a pack read at run time, whose bytes the game doesn’t keep.
Source§impl Pack<'static>
impl Pack<'static>
Sourcepub fn into_layer(self, name: &'static str) -> Layer
pub fn into_layer(self, name: &'static str) -> Layer
A bundle layer of the pack’s files, shown as name, standing for
the bundle it was baked from (Layer::standing_for). A game opens
its pack once, at start-up (most simply one it embeds with
include_bytes!): the files it unpacked are kept for the rest of
the run, as the files a game embeds are.