[−][src]Struct main_error::MainError
Newtype wrapper around a boxed std::error::Error
.
- It implements
Debug
so that it can be used infn main() -> Result<(), MainError>
. - It implements
From<E>
forE: Into<Box<dyn Error>>
so that it works as a drop-in for any type that can be converted into a boxedError
(i.e., anError
trait object).
MainError
can only be constructed through its From
impl:
Explicitly with from
/into
or implicitly through the ?
operator.
Example
Explicit construction via MainError::from
:
let e = MainError::from("something convertible to Box<dyn Error>");Run
Or via into()
when the target type can be inferred from the context:
ⓘThis example panics
fn main() -> Result<(), MainError> { Err("something convertible to Box<dyn Error>".into()) }Run
Or even easier via ?
:
ⓘThis example panics
fn main() -> Result<(), MainError> { Err("something convertible to Box<dyn Error>")? }Run
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for MainError
impl !Send for MainError
impl !Sync for MainError
impl Unpin for MainError
impl !UnwindSafe for MainError
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,