Skip to main content

AnimationResource

Struct AnimationResource 

Source
pub struct AnimationResource<'a> { /* private fields */ }
Expand description

A parsed .ssab. It is read-only, and can back any number of Contexts.

Implementations§

Source§

impl<'a> AnimationResource<'a>

Source

pub unsafe fn new(data: &'a [u8]) -> Result<Self, SSRuntimeError>

Parses the animations’ metadata out of data. Fails on a schema-version mismatch.

§Safety

The bytes must be a valid .ssab. They are read through FlatBuffers accessors that do not bounds-check in release builds, so any other bytes are undefined behaviour (out-of-bounds reads). A pack the converter wrote is valid; for any other, run the FlatBuffers verifier first (the ssab crate’s checked root_as_ss_anime_binary).

Source

pub fn get_ssab_data(&self) -> &'a [u8] ⓘ

The .ssab bytes this resource reads.

Source

pub fn animations(&self) -> &[AnimationMetadata<'a>]

The pack’s animations, in the order of the ssab’s animations().

Source

pub fn get_animation_names(&self) -> Vec<String>

The animations’ names, in the same order as Self::animations.

Source

pub fn find_animation_index(&self, name: &str) -> Option<usize>

The position of the animation name in Self::animations.

Source

pub fn find_animation_index_by_hash(&self, hash: u32) -> Option<usize>

Auto Trait Implementations§

§

impl<'a> Freeze for AnimationResource<'a>

§

impl<'a> RefUnwindSafe for AnimationResource<'a>

§

impl<'a> Send for AnimationResource<'a>

§

impl<'a> Sync for AnimationResource<'a>

§

impl<'a> Unpin for AnimationResource<'a>

§

impl<'a> UnsafeUnpin for AnimationResource<'a>

§

impl<'a> UnwindSafe for AnimationResource<'a>

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> 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.

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more