[][src]Trait goods::Asset

pub trait Asset: Send + Sync + Sized + 'static {
    type Error: Error + Send + Sync + 'static;
    type Repr: Send;
    type Context;
    type BuildFuture: Future<Output = Result<Self, Self::Error>> + Send + 'static;
    fn build(repr: Self::Repr, ctx: &mut Self::Context) -> Self::BuildFuture;
}

Loaded, processed and prepared asset. This trait specifies how asset instances can be built from intermediate values that are produced by Format implemetations.

Associated Types

type Error: Error + Send + Sync + 'static

Error that may occur during asset building.

type Repr: Send

Intermediate representation type for the asset. This representation is constructed by Format::decode.

type Context

Asset processing context. Instance of context is required to convert asset intermediate representation into asset instance. Special context type PhantomContext can be specified if no context is required, reducing overhead and making asset building occur faster.

type BuildFuture: Future<Output = Result<Self, Self::Error>> + Send + 'static

Asynchronous result produced by asset building.

Loading content...

Required methods

fn build(repr: Self::Repr, ctx: &mut Self::Context) -> Self::BuildFuture

Build asset instance from intermediate representation using provided context.

Loading content...

Implementors

impl<S> Asset for S where
    S: SyncAsset
[src]

type Error = S::Error

type Repr = S::Repr

type Context = S::Context

type BuildFuture = Ready<Result<Self, Self::Error>>

Loading content...