Trait bevy::asset::AssetIo

pub trait AssetIo: 'static + Downcast + Send + Sync {
    fn load_path<'a>(
        &'a self,
        path: &'a Path
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8, Global>, AssetIoError>> + Send + 'a, Global>>; fn read_directory(
        &self,
        path: &Path
    ) -> Result<Box<dyn Iterator<Item = PathBuf> + 'static, Global>, AssetIoError>; fn get_metadata(&self, path: &Path) -> Result<Metadata, AssetIoError>; fn watch_path_for_changes(&self, path: &Path) -> Result<(), AssetIoError>; fn watch_for_changes(&self) -> Result<(), AssetIoError>; fn is_dir(&self, path: &Path) -> bool { ... } fn is_file(&self, path: &Path) -> bool { ... } }
Expand description

A storage provider for an AssetServer.

An asset I/O is the backend actually providing data for the asset loaders managed by the asset server. An average user will probably be just fine with the default FileAssetIo, but you can easily use your own custom I/O to, for example, load assets from cloud storage or create a seamless VFS layout using custom containers.

See the custom_asset_io example in the repository for more details.

Required Methods§

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

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

Returns metadata about the filesystem entry at the provided path.

Tells the asset I/O to watch for changes recursively at the provided path.

Enables change tracking in this asset I/O.

Provided Methods§

Returns true if the path is a directory.

Returns true if the path is a file.

Implementations§

Returns true if the trait object wraps an object of type __T.

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Implementors§