Struct notify::Config

source ·
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

source

pub fn with_poll_interval(self, dur: Duration) -> Self

For the PollWatcher backend.

Interval between each re-scan 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.

This will enable automatic polling, overwriting with_manual_polling.

source

pub fn poll_interval(&self) -> Duration

👎Deprecated since 6.1.0: use poll_interval_v2 to account for disabled automatic polling

Returns current setting

source

pub fn poll_interval_v2(&self) -> Option<Duration>

Returns current setting

source

pub fn with_manual_polling(self) -> Self

For the PollWatcher backend.

Disable automatic polling. Requires calling crate::PollWatcher::poll manually.

This will disable automatic polling, overwriting with_poll_interval.

source

pub fn with_compare_contents(self, compare_contents: bool) -> Self

For the PollWatcher backend.

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.

source

pub fn compare_contents(&self) -> bool

Returns current setting

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Hash for Config

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Config

source§

fn eq(&self, other: &Config) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Config

source§

impl Eq for Config

source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.