pub struct Assets { /* private fields */ }Implementations§
Source§impl Assets
impl Assets
Sourcepub fn new(root: impl AsRef<Path>) -> Result<Assets, Error>
pub fn new(root: impl AsRef<Path>) -> Result<Assets, Error>
Create with root as the asset directory. Path is canonicalized eagerly to make
matching against notify events deterministic.
pub fn root(&self) -> &Path
pub fn resolve(&self, rel: impl AsRef<Path>) -> PathBuf
pub fn read(&self, rel: impl AsRef<Path>) -> Result<Vec<u8>, Error>
Sourcepub fn watch(&mut self) -> Result<(), Error>
pub fn watch(&mut self) -> Result<(), Error>
Start watching the asset root recursively. Idempotent.
Sourcepub fn drain_changes(&mut self) -> Vec<PathBuf>
pub fn drain_changes(&mut self) -> Vec<PathBuf>
Drain all queued filesystem changes since last call. Paths are canonicalized when possible. Idempotent across re-saves within one frame (HashSet-deduped).
Auto Trait Implementations§
impl Freeze for Assets
impl RefUnwindSafe for Assets
impl Send for Assets
impl !Sync for Assets
impl Unpin for Assets
impl UnsafeUnpin for Assets
impl UnwindSafe for Assets
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.