[−][src]Struct rocket::error::LaunchError
An error that occurs during launch.
A LaunchError
is returned by launch()
when
launching an application fails.
Panics
A value of this type panics if it is dropped without first being inspected.
An inspection occurs when any method is called. For instance, if
println!("Error: {}", e)
is called, where e: LaunchError
, the
Display::fmt
method being called by println!
results in e
being marked
as inspected; a subsequent drop
of the value will not result in a panic.
The following snippet illustrates this:
let error = rocket::ignite().launch(); // This line is only reached if launching failed. This "inspects" the error. println!("Launch failed! Error: {}", error); // This call to drop (explicit here for demonstration) will do nothing. drop(error);
When a value of this type panics, the corresponding error message is pretty printed to the console. The following illustrates this:
let error = rocket::ignite().launch(); // This call to drop (explicit here for demonstration) will result in // `error` being pretty-printed to the console along with a `panic!`. drop(error);
Usage
A LaunchError
value should usually be allowed to drop
without
inspection. There are two exceptions to this suggestion.
-
If you are writing a library or high-level application on-top of Rocket, you likely want to inspect the value before it drops to avoid a Rocket-specific
panic!
. This typically means simply printing the value. -
You want to display your own error messages.
Methods
impl LaunchError
[src]
pub fn kind(&self) -> &LaunchErrorKind
[src]
Retrieve the kind
of the launch error.
Example
let error = rocket::ignite().launch(); // This line is only reached if launch failed. let error_kind = error.kind();
Trait Implementations
impl Debug for LaunchError
[src]
impl Display for LaunchError
[src]
impl Drop for LaunchError
[src]
impl Error for LaunchError
[src]
fn description(&self) -> &str
[src]
fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
fn backtrace(&self) -> Option<&Backtrace>
[src]
fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl From<Error> for LaunchError
[src]
fn from(error: Error) -> LaunchError
[src]
impl From<Error> for LaunchError
[src]
fn from(error: Error) -> LaunchError
[src]
Auto Trait Implementations
impl !RefUnwindSafe for LaunchError
impl Send for LaunchError
impl Sync for LaunchError
impl Unpin for LaunchError
impl !UnwindSafe for LaunchError
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, I> AsResult<T, I> for T where
I: Input,
[src]
I: Input,
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<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoCollection<T> for T
[src]
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
[src]
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
[src]
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
[src]
T: Any,