[][src]Trait goods::Format

pub trait Format<A: Asset, K>: MaybeSend + 'static {
    type Error: Error + MaybeSend + MaybeSync + 'static;
    type DecodeFuture: Future<Output = Result<A::Repr, Self::Error>> + MaybeSend + 'static;
    fn decode(self, bytes: Vec<u8>, cache: &Cache<K>) -> Self::DecodeFuture;
}

Format trait interprets raw bytes as an asset. It may also use context for asset instance creation and Cache to load compound assets.

Associated Types

type Error: Error + MaybeSend + MaybeSync + 'static

Error that may occur during asset loading.

type DecodeFuture: Future<Output = Result<A::Repr, Self::Error>> + MaybeSend + 'static

Asynchronous result produced by the format loading.

Loading content...

Required methods

fn decode(self, bytes: Vec<u8>, cache: &Cache<K>) -> Self::DecodeFuture

Decode asset intermediate representation from raw data using cache to fetch sub-assets.

Loading content...

Implementors

impl<A, K> Format<A, K> for JsonFormat where
    A: Asset,
    A::Repr: DeserializeOwned
[src]

type Error = Error

type DecodeFuture = Ready<Result<A::Repr, Self::Error>>

impl<A, K> Format<A, K> for PassthroughFormat where
    A: Asset,
    A::Repr: From<Vec<u8>>, 
[src]

type Error = Infallible

type DecodeFuture = Ready<Result<A::Repr, Infallible>>

impl<A, K> Format<A, K> for RonFormat where
    A: Asset,
    A::Repr: DeserializeOwned
[src]

type Error = Error

type DecodeFuture = Ready<Result<A::Repr, Self::Error>>

impl<A, K> Format<A, K> for YamlFormat where
    A: Asset,
    A::Repr: DeserializeOwned
[src]

type Error = Error

type DecodeFuture = Ready<Result<A::Repr, Self::Error>>

Loading content...