pub struct AssetWatcher { /* private fields */ }Expand description
Drains filesystem-change events under a project’s assets/ directory.
Holds notify’s RecommendedWatcher alive — drop the AssetWatcher
to stop watching.
Implementations§
Source§impl AssetWatcher
impl AssetWatcher
Sourcepub fn new(assets_root: impl Into<PathBuf>) -> Result<Self>
pub fn new(assets_root: impl Into<PathBuf>) -> Result<Self>
Starts watching assets_root recursively. Future writes / creates /
removes under that tree produce events drained via Self::poll.
Returns an error if notify fails to construct a recommended watcher
or to register the path (e.g. the path doesn’t exist or the OS denies
the watch). The editor passes a path it has just create_dir_all’d,
so this should be reliable in practice.
Sourcepub fn assets_root(&self) -> &Path
pub fn assets_root(&self) -> &Path
Returns the watched assets root.
Sourcepub fn poll(&self) -> Vec<AssetChangeEvent>
pub fn poll(&self) -> Vec<AssetChangeEvent>
Drains all pending events without blocking.
Coalesces repeated Modified events on the same path within the same
drain — notify v6 fires multiple Modified for one save on Windows.
The order of distinct events is preserved for events on different
paths.
Auto Trait Implementations§
impl Freeze for AssetWatcher
impl RefUnwindSafe for AssetWatcher
impl Send for AssetWatcher
impl Sync for AssetWatcher
impl Unpin for AssetWatcher
impl UnsafeUnpin for AssetWatcher
impl UnwindSafe for AssetWatcher
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
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>
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>
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