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.