Trait distill_importer::AsyncImporter[][src]

pub trait AsyncImporter: Send + 'static {
    type Options: Send + Sync + 'static;
    type State: Serialize + Send + 'static;
    fn version_static() -> u32
    where
        Self: Sized
;
fn version(&self) -> u32;
fn import<'a>(
        &'a self,
        op: &'a mut ImportOp,
        source: &'a mut (dyn AsyncRead + Unpin + Send + Sync),
        options: &'a Self::Options,
        state: &'a mut Self::State
    ) -> BoxFuture<'a, Result<ImporterValue>>; fn export<'a>(
        &'a self,
        _output: &'a mut (dyn AsyncWrite + Unpin + Send + Sync),
        _options: &'a Self::Options,
        _state: &'a mut Self::State,
        _assets: Vec<ExportAsset>
    ) -> BoxFuture<'a, Result<ImporterValue>> { ... } }

Importers parse file formats and produce assets.

Associated Types

type Options: Send + Sync + 'static[src]

Options can store settings that change importer behaviour. Will be automatically stored in .meta files and passed to Importer::import.

type State: Serialize + Send + 'static[src]

State is maintained by the asset pipeline to enable Importers to store state between calls to import(). This is primarily used to ensure IDs are stable between imports by storing generated AssetUuids with mappings to format-internal identifiers.

Loading content...

Required methods

fn version_static() -> u32 where
    Self: Sized
[src]

Returns the version of the importer. This version should change any time the importer behaviour changes to trigger reimport of assets.

fn version(&self) -> u32[src]

Returns the version of the importer. This version should change any time the importer behaviour changes to trigger reimport of assets.

fn import<'a>(
    &'a self,
    op: &'a mut ImportOp,
    source: &'a mut (dyn AsyncRead + Unpin + Send + Sync),
    options: &'a Self::Options,
    state: &'a mut Self::State
) -> BoxFuture<'a, Result<ImporterValue>>
[src]

Reads the given bytes and produces assets.

Loading content...

Provided methods

fn export<'a>(
    &'a self,
    _output: &'a mut (dyn AsyncWrite + Unpin + Send + Sync),
    _options: &'a Self::Options,
    _state: &'a mut Self::State,
    _assets: Vec<ExportAsset>
) -> BoxFuture<'a, Result<ImporterValue>>
[src]

Writes a set of assets to a source file format that can be read by import.

Loading content...

Implementors

impl<T: Importer + Sync> AsyncImporter for T[src]

type Options = <T as Importer>::Options

Options can store settings that change importer behaviour. Will be automatically stored in .meta files and passed to Importer::import.

type State = <T as Importer>::State

State is maintained by the asset pipeline to enable Importers to store state between calls to import(). This is primarily used to ensure IDs are stable between imports by storing generated AssetUuids with mappings to format-internal identifiers.

fn import<'a>(
    &'a self,
    op: &'a mut ImportOp,
    source: &'a mut (dyn AsyncRead + Unpin + Send + Sync),
    options: &'a Self::Options,
    state: &'a mut Self::State
) -> BoxFuture<'a, Result<ImporterValue>>
[src]

Reads the given bytes and produces assets.

fn export<'a>(
    &'a self,
    output: &'a mut (dyn AsyncWrite + Unpin + Send + Sync),
    options: &'a Self::Options,
    state: &'a mut Self::State,
    assets: Vec<ExportAsset>
) -> BoxFuture<'a, Result<ImporterValue>>
[src]

Writes a set of assets to a source file format that can be read by import.

Loading content...