Struct Error

pub struct Error { pub kind: ErrorKind, pub paths: Vec<PathBuf>, /* private fields */ }

Notify error type.

Errors are emitted either at creation time of a Watcher, or during the event stream. They range from kernel errors to filesystem errors to argument errors.

Errors can be general, or they can be about specific paths or subtrees. In that later case, the error's paths field will be populated.

Fields

kind: ErrorKind

Kind of the error.

paths: Vec<PathBuf>

Relevant paths to the error, if any.

Implementations

impl Error

fn user_data(&self) -> Option<u64>

Returns the application-defined value associated with this error.

Errors returned by crate::Watcher::watch_with carry the value from its configuration. For a failed watch operation in crate::Watcher::update_paths, the source error carries that operation's value. Errors delivered to the event handler carry the reporting watch's value, including errors encountered while installing recursive watches.

None means no value was configured or the error has no specific watch or watch operation. Some(value) does not guarantee that other watches are unaffected.

fn set_user_data(self, user_data: u64) -> Self

Sets Error::user_data.

fn add_path(self, path: PathBuf) -> Self

Adds a path to the error.

fn set_paths(self, paths: Vec<PathBuf>) -> Self

Replaces the paths for the error.

fn new(kind: ErrorKind) -> Self

Creates a new Error with empty paths given its kind.

fn generic(msg: &str) -> Self

Creates a new generic Error from a message.

fn io(err: Error) -> Self

Creates a new i/o Error from a stdlib io::Error.

fn io_watch(err: Error) -> Self

Similar to Error::io, but specifically handles io::ErrorKind::NotFound.

fn path_not_found() -> Self

Creates a new "path not found" error.

fn watch_not_found() -> Self

Creates a new "watch not found" error.

fn invalid_config(config: &Config) -> Self

Creates a new "invalid config" error from the given Config.

Trait Implementations

impl Debug for Error

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

impl Display for Error

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

impl Error for Error

fn cause(&self) -> Option<&dyn StdError>

impl From<Error> for Error

fn from(err: Error) -> Self

impl From<RecvError> for Error

fn from(err: RecvError) -> Self

impl From<UpdatePathsError> for Error

fn from(value: UpdatePathsError) -> Self

impl<T> From<PoisonError<T>> for Error

fn from(err: PoisonError<T>) -> Self

impl<T> From<SendError<T>> for Error

fn from(err: SendError<T>) -> Self

Auto Trait Implementations

impl !RefUnwindSafe for Error

impl !UnwindSafe for Error

impl Freeze for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl UnsafeUnpin for Error

Blanket Implementations

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

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

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

impl<T> From<T> for Error

impl<T> ToString for Error where T: Display + ?Sized,

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

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

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