Struct bevy_asset::FileAssetIo
source · pub struct FileAssetIo { /* private fields */ }
Expand description
I/O implementation for the local filesystem.
This asset I/O is fully featured but it’s not available on android
and wasm
targets.
Implementations§
source§impl FileAssetIo
impl FileAssetIo
sourcepub fn new<P: AsRef<Path>>(
path: P,
watch_for_changes: &Option<ChangeWatcher>
) -> Self
pub fn new<P: AsRef<Path>>( path: P, watch_for_changes: &Option<ChangeWatcher> ) -> Self
Creates a new FileAssetIo
at a path relative to the executable’s directory, optionally
watching for changes.
See get_base_path
below.
sourcepub fn get_base_path() -> PathBuf
pub fn get_base_path() -> PathBuf
Returns the base path of the assets directory, which is normally the executable’s parent directory.
If a BEVY_ASSET_ROOT
environment variable is set, then its value will be used.
Else if the CARGO_MANIFEST_DIR
environment variable is set, then its value will be used
instead. It’s set by cargo when running with cargo run
.
sourcepub fn root_path(&self) -> &PathBuf
pub fn root_path(&self) -> &PathBuf
Returns the root directory where assets are loaded from.
See get_base_path
.
Trait Implementations§
source§impl AssetIo for FileAssetIo
impl AssetIo for FileAssetIo
source§fn load_path<'a>(
&'a self,
path: &'a Path
) -> BoxedFuture<'a, Result<Vec<u8>, AssetIoError>>
fn load_path<'a>( &'a self, path: &'a Path ) -> BoxedFuture<'a, Result<Vec<u8>, AssetIoError>>
Returns a future to load the full file data at the provided path.
source§fn read_directory(
&self,
path: &Path
) -> Result<Box<dyn Iterator<Item = PathBuf>>, AssetIoError>
fn read_directory( &self, path: &Path ) -> Result<Box<dyn Iterator<Item = PathBuf>>, AssetIoError>
Returns an iterator of directory entry names at the provided path.
source§fn watch_path_for_changes(
&self,
to_watch: &Path,
to_reload: Option<PathBuf>
) -> Result<(), AssetIoError>
fn watch_path_for_changes( &self, to_watch: &Path, to_reload: Option<PathBuf> ) -> Result<(), AssetIoError>
Tells the asset I/O to watch for changes recursively at the provided path. Read more
source§fn watch_for_changes(
&self,
configuration: &ChangeWatcher
) -> Result<(), AssetIoError>
fn watch_for_changes( &self, configuration: &ChangeWatcher ) -> Result<(), AssetIoError>
Enables change tracking in this asset I/O.
source§fn get_metadata(&self, path: &Path) -> Result<Metadata, AssetIoError>
fn get_metadata(&self, path: &Path) -> Result<Metadata, AssetIoError>
Returns metadata about the filesystem entry at the provided path.
Auto Trait Implementations§
impl RefUnwindSafe for FileAssetIo
impl Send for FileAssetIo
impl Sync for FileAssetIo
impl Unpin for FileAssetIo
impl UnwindSafe for FileAssetIo
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.