pub mod prelude;
use core::fmt::{Debug, Display};
use alloc::boxed::Box;
use crate::{AdHocError, Error, ErrorData, StashedErrors, WrappedError};
pub trait Reportable: Display + Debug {}
pub type Result<T, E = prelude::Error> = core::result::Result<T, E>;
#[cfg_attr(
any(feature = "rust-v1.81", feature = "std"),
doc = r##"
```
use lazy_errors::prelude as lazy_errors_regular;
use lazy_errors::surrogate_error_trait::prelude as lazy_errors_surrogate;
let regular_error = lazy_errors_regular::Error::from_message("");
let surrogate_error = lazy_errors_surrogate::Error::from_message("");
let mut regular_stash = lazy_errors_regular::ErrorStash::new(|| "");
let mut surrogate_stash = lazy_errors_surrogate::ErrorStash::new(|| "");
regular_stash.push(surrogate_error);
surrogate_stash.push(regular_error);
```
"##
)]
pub type Stashable<'a> =
alloc::boxed::Box<dyn crate::Reportable + Send + Sync + 'a>;
impl<'a, E> From<E> for Box<dyn Reportable + 'a>
where
E: Reportable + 'a,
{
fn from(val: E) -> Self {
Box::new(val)
}
}
impl<'a, E> From<E> for Box<dyn Reportable + Send + 'a>
where
E: Reportable + Send + 'a,
{
fn from(val: E) -> Self {
Box::new(val)
}
}
impl<'a, E> From<E> for Box<dyn Reportable + Sync + 'a>
where
E: Reportable + Sync + 'a,
{
fn from(val: E) -> Self {
Box::new(val)
}
}
impl<'a, E> From<E> for Box<dyn Reportable + Send + Sync + 'a>
where
E: Reportable + Send + Sync + 'a,
{
fn from(val: E) -> Self {
Box::new(val)
}
}
impl<I> Reportable for Error<I> where I: Display + Debug {}
impl<I> Reportable for ErrorData<I> where I: Display + Debug {}
impl<I> Reportable for StashedErrors<I> where I: Display + Debug {}
impl<I> Reportable for WrappedError<I> where I: Display + Debug {}
impl Reportable for AdHocError {}
impl Reportable for alloc::string::String {}
impl Reportable for &str {}
impl Reportable for core::convert::Infallible {}
impl Reportable for core::alloc::LayoutError {}
impl Reportable for core::array::TryFromSliceError {}
impl Reportable for core::cell::BorrowError {}
impl Reportable for core::cell::BorrowMutError {}
impl Reportable for core::char::CharTryFromError {}
impl Reportable for core::char::DecodeUtf16Error {}
impl Reportable for core::char::ParseCharError {}
impl Reportable for core::char::TryFromCharError {}
impl Reportable for alloc::collections::TryReserveError {}
#[cfg(feature = "rust-v1.69")]
impl Reportable for core::ffi::FromBytesUntilNulError {}
#[cfg(feature = "rust-v1.64")]
impl Reportable for core::ffi::FromBytesWithNulError {}
#[cfg(feature = "rust-v1.64")]
impl Reportable for alloc::ffi::FromVecWithNulError {}
#[cfg(feature = "rust-v1.64")]
impl Reportable for alloc::ffi::IntoStringError {}
#[cfg(feature = "rust-v1.64")]
impl Reportable for alloc::ffi::NulError {}
impl Reportable for core::fmt::Error {}
#[cfg(feature = "rust-v1.77")]
impl Reportable for core::net::AddrParseError {}
impl Reportable for core::num::ParseFloatError {}
impl Reportable for core::num::ParseIntError {}
impl Reportable for core::num::TryFromIntError {}
impl Reportable for core::str::ParseBoolError {}
impl Reportable for core::str::Utf8Error {}
impl Reportable for alloc::string::FromUtf8Error {}
impl Reportable for alloc::string::FromUtf16Error {}
#[cfg(feature = "rust-v1.66")]
impl Reportable for core::time::TryFromFloatSecsError {}