Trait bevy::asset::io::AssetReader

pub trait AssetReader: Send + Sync + 'static {
    // Required methods
    fn read<'a>(&'a self, path: &'a Path) -> impl ConditionalSendFuture;
    fn read_meta<'a>(&'a self, path: &'a Path) -> impl ConditionalSendFuture;
    fn read_directory<'a>(
        &'a self,
        path: &'a Path
    ) -> impl ConditionalSendFuture;
    fn is_directory<'a>(&'a self, path: &'a Path) -> impl ConditionalSendFuture;

    // Provided method
    fn read_meta_bytes<'a>(
        &'a self,
        path: &'a Path
    ) -> impl ConditionalSendFuture { ... }
}
Expand description

Performs read operations on an asset storage. AssetReader exposes a “virtual filesystem” API, where asset bytes and asset metadata bytes are both stored and accessible for a given path. This trait is not object safe, if needed use a dyn ErasedAssetReader instead.

Also see AssetWriter.

Required Methods§

fn read<'a>(&'a self, path: &'a Path) -> impl ConditionalSendFuture

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

fn read_meta<'a>(&'a self, path: &'a Path) -> impl ConditionalSendFuture

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

fn read_directory<'a>(&'a self, path: &'a Path) -> impl ConditionalSendFuture

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

fn is_directory<'a>(&'a self, path: &'a Path) -> impl ConditionalSendFuture

Returns true if the provided path points to a directory.

Provided Methods§

fn read_meta_bytes<'a>(&'a self, path: &'a Path) -> impl ConditionalSendFuture

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

Object Safety§

This trait is not object safe.

Implementors§