pub struct WatchConfig { /* private fields */ }Expand description
Configuration for the file watcher.
Implementations§
Source§impl WatchConfig
impl WatchConfig
Sourcepub const fn new(directory: PathBuf, poll_interval: Duration) -> Self
pub const fn new(directory: PathBuf, poll_interval: Duration) -> Self
Creates a new WatchConfig.
§Arguments
directory— Path to the directory to watch.poll_interval— Duration between successive polls.
§Examples
use ssg::watch::WatchConfig;
use std::path::PathBuf;
use std::time::Duration;
let cfg = WatchConfig::new(PathBuf::from("content"), Duration::from_secs(1));
assert_eq!(cfg.poll_interval(), Duration::from_secs(1));Sourcepub fn directory(&self) -> &Path
pub fn directory(&self) -> &Path
Returns a reference to the watched directory.
§Examples
use ssg::watch::WatchConfig;
use std::path::{Path, PathBuf};
use std::time::Duration;
let cfg = WatchConfig::new(PathBuf::from("docs"), Duration::from_secs(2));
assert_eq!(cfg.directory(), Path::new("docs"));Sourcepub const fn poll_interval(&self) -> Duration
pub const fn poll_interval(&self) -> Duration
Returns the configured poll interval.
§Examples
use ssg::watch::WatchConfig;
use std::path::PathBuf;
use std::time::Duration;
let cfg = WatchConfig::new(PathBuf::from("d"), Duration::from_millis(500));
assert_eq!(cfg.poll_interval(), Duration::from_millis(500));Trait Implementations§
Source§impl Clone for WatchConfig
impl Clone for WatchConfig
Source§fn clone(&self) -> WatchConfig
fn clone(&self) -> WatchConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WatchConfig
impl RefUnwindSafe for WatchConfig
impl Send for WatchConfig
impl Sync for WatchConfig
impl Unpin for WatchConfig
impl UnsafeUnpin for WatchConfig
impl UnwindSafe for WatchConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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