Struct serbzip_core::succinct::Errorlike
source · [−]pub struct Errorlike<T>(pub T);Expand description
Errorlike is a newtype for conditionally implementing the Error trait on types that
satisfy Debug and Display but do not implement Error directly.
This is used when you need to return an Error, but don’t have one handy.
Examples
use std::error::Error;
use serbzip_core::succinct::CowStr;
use serbzip_core::succinct::Errorlike;
fn main() -> Result<(), Box<dyn Error>> {
if something_wrong() {
return Err(Errorlike("something awful just happened"))?;
}
Ok(())
}Tuple Fields
0: TImplementations
Trait Implementations
sourceimpl<T: Display + Debug> Error for Errorlike<T>
impl<T: Display + Debug> Error for Errorlike<T>
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
👎 Deprecated since 1.42.0:
use the Display impl or to_string()
sourceimpl From<Errorlike<Cow<'static, str>>> for ReadFromTextFileError
impl From<Errorlike<Cow<'static, str>>> for ReadFromTextFileError
sourcefn from(error: OverflowError) -> Self
fn from(error: OverflowError) -> Self
Converts to this type from the input type.
impl<T: Eq> Eq for Errorlike<T>
impl<T> StructuralEq for Errorlike<T>
impl<T> StructuralPartialEq for Errorlike<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Errorlike<T> where
T: RefUnwindSafe,
impl<T> Send for Errorlike<T> where
T: Send,
impl<T> Sync for Errorlike<T> where
T: Sync,
impl<T> Unpin for Errorlike<T> where
T: Unpin,
impl<T> UnwindSafe for Errorlike<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more