pub struct Config { /* private fields */ }
Expand description
Watcher Backend configuration
This contains multiple settings that may relate to only one specific backend, such as to correctly configure each backend regardless of what is selected during runtime.
let config = Config::default()
.with_poll_interval(Duration::from_secs(2))
.with_compare_contents(true);
Some options can be changed during runtime, others have to be set when creating the watcher backend.
Implementations§
source§impl Config
impl Config
sourcepub fn with_poll_interval(self, dur: Duration) -> Self
pub fn with_poll_interval(self, dur: Duration) -> Self
Interval between each rescan attempt. This can be extremely expensive for large file trees so it is recommended to measure and tune accordingly.
The default poll frequency is 30 seconds.
sourcepub fn poll_interval(&self) -> Duration
pub fn poll_interval(&self) -> Duration
Returns current setting
sourcepub fn with_compare_contents(self, compare_contents: bool) -> Self
pub fn with_compare_contents(self, compare_contents: bool) -> Self
Optional feature that will evaluate the contents of changed files to determine if
they have indeed changed using a fast hashing algorithm. This is especially important
for pseudo filesystems like those on Linux under /sys and /proc which are not obligated
to respect any other filesystem norms such as modification timestamps, file sizes, etc.
By enabling this feature, performance will be significantly impacted as all files will
need to be read and hashed at each poll_interval
.
This can’t be changed during runtime. Off by default.
sourcepub fn compare_contents(&self) -> bool
pub fn compare_contents(&self) -> bool
Returns current setting