#[non_exhaustive]pub struct WatchOpts {
pub recursive: bool,
pub interval: Duration,
pub max_entries: usize,
pub max_tracked: usize,
pub max_depth: usize,
}Expand description
Options for Backend::watch.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.recursive: boolAlso report changes below subdirectories. Default false: direct children only.
interval: DurationPoll interval for polling backends. Default 250 ms; values under 10 ms are raised to 10 ms and values over one
hour (MAX_INTERVAL) are lowered to it. Ignored by backends that are not polling.
max_entries: usizeAt most this many paths in one batch. Past it the batch is rescan: true with an empty changed.
max_tracked: usizeAt most this many entries a polling backend keeps in memory to compare against (the size of the watched tree).
A watch that would have to track more is refused at the start (TooLarge), and a watch whose tree grows past it
sends rescan and then reports nothing until the tree is small enough again: it is a memory bound, not a
filter. Unrelated to max_entries, which caps one batch. Default DEFAULT_MAX_TRACKED.
max_depth: usizeHow many directory levels below the watched directory a recursive polling watch descends. Default
DEFAULT_MAX_DEPTH (64). The watched directory is level 0, its subdirectories level 1, and so on; with the
default, a directory 65 levels down is too deep. Ignored when recursive is false and by backends that do not
scan.
A tree deeper than this is handled exactly like one with more than max_tracked entries:
the scan is incomplete, so a watch that would start on one is refused (TooLarge), and a watch whose tree
grows past the limit sends one rescan and then reports nothing until the tree is within it again. It is never
an error mid-watch and never a silent skip of the deep part. Like max_tracked it is a bound, not a filter.
It bounds work and descriptors: a scan holds one open directory handle per level on the way down, so at most
max_depth + 1 at a time. Do not set it close to the process’s descriptor limit; a scan that runs out of
descriptors is also reported as incomplete.
Implementations§
Source§impl WatchOpts
impl WatchOpts
Sourcepub fn recursive(self, recursive: bool) -> Self
pub fn recursive(self, recursive: bool) -> Self
Set WatchOpts::recursive.
Sourcepub fn interval(self, interval: Duration) -> Self
pub fn interval(self, interval: Duration) -> Self
Set WatchOpts::interval.
Sourcepub fn max_entries(self, max_entries: usize) -> Self
pub fn max_entries(self, max_entries: usize) -> Self
Sourcepub fn max_tracked(self, max_tracked: usize) -> Self
pub fn max_tracked(self, max_tracked: usize) -> Self
Sourcepub fn max_depth(self, max_depth: usize) -> Self
pub fn max_depth(self, max_depth: usize) -> Self
Set WatchOpts::max_depth.
Trait Implementations§
impl Eq for WatchOpts
impl StructuralPartialEq for WatchOpts
Auto Trait Implementations§
impl Forget for WatchOpts
impl Freeze for WatchOpts
impl Move for WatchOpts
impl RefUnwindSafe for WatchOpts
impl Send for WatchOpts
impl Sync for WatchOpts
impl Unpin for WatchOpts
impl UnsafeUnpin for WatchOpts
impl UnwindSafe for WatchOpts
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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