Struct veloren_common_assets::source::FileSystem
pub struct FileSystem {
path: PathBuf,
}
Expand description
A Source
to load assets from a directory in the file system.
This is the default Source
of [AssetCache
].
§Hot-reloading
This source supports hot-reloading: when a file is edited, the corresponding
assets are reloaded when [AssetCache::hot_reload
] is called.
§WebAssembly
This source does not work in WebAssembly, because there is no file system. When called, it always returns an error.
Fields§
§path: PathBuf
Implementations§
§impl FileSystem
impl FileSystem
pub fn new<P>(path: P) -> Result<FileSystem, Error>
pub fn new<P>(path: P) -> Result<FileSystem, Error>
Creates a new FileSystem
from a directory.
Generally you do not need to call this function directly, as the
[AssetCache::new
] method provides a shortcut to create a cache
reading from the filesystem.
§Errors
An error can occur if path
is not a valid readable directory.
Trait Implementations§
§impl Clone for FileSystem
impl Clone for FileSystem
§fn clone(&self) -> FileSystem
fn clone(&self) -> FileSystem
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for FileSystem
impl Debug for FileSystem
§impl Source for FileSystem
impl Source for FileSystem
§fn read(&self, id: &str, ext: &str) -> Result<FileContent<'_>, Error>
fn read(&self, id: &str, ext: &str) -> Result<FileContent<'_>, Error>
Try reading the source given an id and an extension. Read more
§fn read_dir(
&self,
id: &str,
f: &mut dyn FnMut(DirEntry<'_>),
) -> Result<(), Error>
fn read_dir( &self, id: &str, f: &mut dyn FnMut(DirEntry<'_>), ) -> Result<(), Error>
Reads the content of a directory. Read more
§fn exists(&self, entry: DirEntry<'_>) -> bool
fn exists(&self, entry: DirEntry<'_>) -> bool
Returns
true
if the entry points at an existing entity. Read moreAuto Trait Implementations§
impl Freeze for FileSystem
impl RefUnwindSafe for FileSystem
impl Send for FileSystem
impl Sync for FileSystem
impl Unpin for FileSystem
impl UnwindSafe for FileSystem
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more