Skip to main content

ScenePck

Struct ScenePck 

Source
pub struct ScenePck {
    pub buf: Arc<Vec<u8>>,
    pub header: PackScnHeader,
    pub scn_name_map: HashMap<String, usize>,
    pub inc_prop_name_map: HashMap<u32, String>,
    pub inc_cmd_name_map: Arc<HashMap<u32, String>>,
    pub inc_props: Vec<PackIncProp>,
    pub inc_cmds: Vec<PackIncCmd>,
    pub string_codec: SceneStringCodec,
    /* private fields */
}

Fields§

§buf: Arc<Vec<u8>>§header: PackScnHeader§scn_name_map: HashMap<String, usize>§inc_prop_name_map: HashMap<u32, String>§inc_cmd_name_map: Arc<HashMap<u32, String>>§inc_props: Vec<PackIncProp>§inc_cmds: Vec<PackIncCmd>§string_codec: SceneStringCodec

Implementations§

Source§

impl ScenePck

Source

pub fn load_and_rebuild( path: &Path, opt: &ScenePckDecodeOptions, ) -> Result<Self>

Source

pub fn load_and_rebuild_from_bytes( tmp: Vec<u8>, opt: &ScenePckDecodeOptions, ) -> Result<Self>

Source

pub fn load_lazy(path: &Path, opt: &ScenePckDecodeOptions) -> Result<Self>

Opens a pack without rebuilding it: scenes stay compressed (a quarter of the rebuilt size for RewriteHF, 11 MiB instead of 43) and are decompressed when a scene is first used.

Source

pub fn load_lazy_from_bytes( tmp: Vec<u8>, opt: &ScenePckDecodeOptions, ) -> Result<Self>

Source

pub fn is_lazy(&self) -> bool

Whether scenes are decompressed on demand (load_lazy).

Source

pub fn scn_data_slice(&self, scn_no: usize) -> Result<Cow<'_, [u8]>>

A scene’s bytecode (decompressed first for a lazily loaded pack).

Source

pub fn scn_data_shared( &self, scn_no: usize, ) -> Result<(Arc<Vec<u8>>, Range<usize>)>

Return shared backing storage plus the scene-local byte range. SceneStream uses this to borrow directly from the rebuilt Scene.pck (or, lazily loaded, from the scene’s own decompressed buffer) without copying or leaking each visited scene chunk.

Source

pub fn find_scene_no(&self, name_or_index: &str) -> Option<usize>

Source

pub fn find_scene_name(&self, scn_no: usize) -> Option<&str>

Source

pub fn find_inc_cmd_no(&self, cmd_name: &str) -> Option<usize>

Trait Implementations§

Source§

impl Clone for ScenePck

Source§

fn clone(&self) -> ScenePck

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScenePck

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.