pub trait BackendError: Error { }Expand description
Associated error type used by all fallible backend methods.
Backends that are infallible (e.g. Headless, SoftwareRenderer) use
core::convert::Infallible. Fallible backends (e.g. Crossterm) use
std::io::Error.
Requiring core::error::Error rather than just Display +
Debug lets generic code convert B::Error into Box<dyn Error> or any
error-trait-based caller error with a plain ?, and exposes source() chains for concrete
error types that wrap an inner error.
§Examples
use retroglyph_core::backend::BackendError;
use core::fmt;
#[derive(Debug)]
struct MyBackendError;
impl fmt::Display for MyBackendError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "my backend failed")
}
}
impl core::error::Error for MyBackendError {}
impl BackendError for MyBackendError {}Implementations on Foreign Types§
impl BackendError for Infallible
impl BackendError for Error
Available on crate feature
std only.