Skip to main content

EmbeddedImage

Struct EmbeddedImage 

Source
pub struct EmbeddedImage<'a> {
    pub slot: u32,
    pub bytes: &'a [u8],
}
Expand description

One atlas an embedded .ssab carries, still in the form the exporter wrote it: encoded image bytes (PNG), not pixels.

This is the parsing half of embedded support, and it deliberately has no decoder behind it — which is why it is available without the embedded feature. A host with a decoder already — a browser, or an engine’s asset pipeline — wants this; SSPack::decode_embedded is for hosts that would rather the player do it.

The bytes borrow the pack’s .ssab, so nothing is copied to produce them.

Fields§

§slot: u32

The cellmap’s name_hash — what DrawBatch.texture_hash carries.

A slot inside this pack, not an identity for the image: hand it to crate::SSPlayer::texture_key for what crate::SSRenderer is keyed by. The two differ whenever two packs could name one atlas alike, which a tool that names every project’s atlas spritemap1.png does.

§bytes: &'a [u8]

The encoded image exactly as the exporter embedded it.

Auto Trait Implementations§

§

impl<'a> Freeze for EmbeddedImage<'a>

§

impl<'a> RefUnwindSafe for EmbeddedImage<'a>

§

impl<'a> Send for EmbeddedImage<'a>

§

impl<'a> Sync for EmbeddedImage<'a>

§

impl<'a> Unpin for EmbeddedImage<'a>

§

impl<'a> UnsafeUnpin for EmbeddedImage<'a>

§

impl<'a> UnwindSafe for EmbeddedImage<'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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

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
§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,