Trait bevy_asset::io::ErasedAssetReader
source · pub trait ErasedAssetReader: Send + Sync + 'static {
// Required methods
fn read<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<Box<Reader<'a>>, AssetReaderError>>;
fn read_meta<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<Box<Reader<'a>>, AssetReaderError>>;
fn read_directory<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<Box<PathStream>, AssetReaderError>>;
fn is_directory<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<bool, AssetReaderError>>;
fn read_meta_bytes<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<Vec<u8>, AssetReaderError>>;
}
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§
sourcefn read<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<Box<Reader<'a>>, AssetReaderError>>
fn read<'a>( &'a self, path: &'a Path ) -> BoxedFuture<'_, Result<Box<Reader<'a>>, AssetReaderError>>
Returns a future to load the full file data at the provided path.
sourcefn read_meta<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<Box<Reader<'a>>, AssetReaderError>>
fn read_meta<'a>( &'a self, path: &'a Path ) -> BoxedFuture<'_, Result<Box<Reader<'a>>, AssetReaderError>>
Returns a future to load the full file data at the provided path.
sourcefn read_directory<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<Box<PathStream>, AssetReaderError>>
fn read_directory<'a>( &'a self, path: &'a Path ) -> BoxedFuture<'_, Result<Box<PathStream>, AssetReaderError>>
Returns an iterator of directory entry names at the provided path.
sourcefn is_directory<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<bool, AssetReaderError>>
fn is_directory<'a>( &'a self, path: &'a Path ) -> BoxedFuture<'_, Result<bool, AssetReaderError>>
Returns true if the provided path points to a directory.
sourcefn read_meta_bytes<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'_, Result<Vec<u8>, AssetReaderError>>
fn read_meta_bytes<'a>( &'a self, path: &'a Path ) -> BoxedFuture<'_, Result<Vec<u8>, AssetReaderError>>
Reads asset metadata bytes at the given path
into a Vec<u8>
. This is a convenience
function that wraps ErasedAssetReader::read_meta
by default.