pub trait SinkError: Sized {
    // Required method
    fn error_message<T: Display>(message: T) -> Self;

    // Provided methods
    fn error_io(err: Error) -> Self { ... }
    fn error_config(err: ConfigError) -> Self { ... }
}
Expand description

A trait that describes errors that can be reported by searchers and implementations of Sink.

Unless you have a specialized use case, you probably don’t need to implement this trait explicitly. It’s likely that using std::io::Error (which implements this trait) for your error type is good enough, largely because most errors that occur during search will likely be an std::io::Error.

Required Methods§

source

fn error_message<T: Display>(message: T) -> Self

A constructor for converting any value that satisfies the std::fmt::Display trait into an error.

Provided Methods§

source

fn error_io(err: Error) -> Self

A constructor for converting I/O errors that occur while searching into an error of this type.

By default, this is implemented via the error_message constructor.

source

fn error_config(err: ConfigError) -> Self

A constructor for converting configuration errors that occur while building a searcher into an error of this type.

By default, this is implemented via the error_message constructor.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SinkError for Box<dyn Error>

A Box<dyn std::error::Error> can be used as an error for Sink implementations out of the box.

source§

fn error_message<T: Display>(message: T) -> Box<dyn Error>

source§

impl SinkError for Error

An std::io::Error can be used as an error for Sink implementations out of the box.

Implementors§