Trait bevy::asset::io::ErasedAssetReader

pub trait ErasedAssetReader: Send + Sync + 'static {
    // Required methods
    fn read<'a>(
        &'a self,
        path: &'a Path
    ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<Box<dyn AsyncReadAndSeek + Unpin + Sync + Send + 'a>, AssetReaderError>> + 'a>>;
    fn read_meta<'a>(
        &'a self,
        path: &'a Path
    ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<Box<dyn AsyncReadAndSeek + Unpin + Sync + Send + 'a>, AssetReaderError>> + 'a>>;
    fn read_directory<'a>(
        &'a self,
        path: &'a Path
    ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<Box<dyn Stream<Item = PathBuf> + Unpin + Send>, AssetReaderError>> + 'a>>;
    fn is_directory<'a>(
        &'a self,
        path: &'a Path
    ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<bool, AssetReaderError>> + 'a>>;
    fn read_meta_bytes<'a>(
        &'a self,
        path: &'a Path
    ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<Vec<u8>, AssetReaderError>> + 'a>>;
}
Expand description

Equivalent to an AssetReader but using boxed futures, necessary eg. when using a dyn AssetReader, as AssetReader isn’t currently object safe.

Required Methods§

fn read<'a>( &'a self, path: &'a Path ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<Box<dyn AsyncReadAndSeek + Unpin + Sync + Send + 'a>, AssetReaderError>> + 'a>>

Returns a future to load the full file data at the provided path.

fn read_meta<'a>( &'a self, path: &'a Path ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<Box<dyn AsyncReadAndSeek + Unpin + Sync + Send + 'a>, AssetReaderError>> + 'a>>

Returns a future to load the full file data at the provided path.

fn read_directory<'a>( &'a self, path: &'a Path ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<Box<dyn Stream<Item = PathBuf> + Unpin + Send>, AssetReaderError>> + 'a>>

Returns an iterator of directory entry names at the provided path.

fn is_directory<'a>( &'a self, path: &'a Path ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<bool, AssetReaderError>> + 'a>>

Returns true if the provided path points to a directory.

fn read_meta_bytes<'a>( &'a self, path: &'a Path ) -> Pin<Box<dyn ConditionalSendFuture<Output = Result<Vec<u8>, AssetReaderError>> + 'a>>

Reads asset metadata bytes at the given path into a Vec<u8>. This is a convenience function that wraps ErasedAssetReader::read_meta by default.

Implementors§

§

impl<T> ErasedAssetReader for T
where T: AssetReader,