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§
Sourcefn error_message<T: Display>(message: T) -> Self
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§
Sourcefn error_io(err: Error) -> Self
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.
Sourcefn error_config(err: ConfigError) -> Self
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so 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.
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§impl SinkError for Error
An std::io::Error
can be used as an error for Sink
implementations out
of the box.
impl SinkError for Error
An std::io::Error
can be used as an error for Sink
implementations out
of the box.