[−][src]Struct rocket::error::LaunchError
pub struct LaunchError { /* fields omitted */ }
An error that occurs during launch.
A LaunchError
is returned by
rocket::launch when launching an
application fails for some reason.
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]
impl LaunchError
pub fn kind(&self) -> &LaunchErrorKind
[src]
pub fn kind(&self) -> &LaunchErrorKind
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 From<LaunchErrorKind> for LaunchError
[src]
impl From<LaunchErrorKind> for LaunchError
fn from(kind: LaunchErrorKind) -> LaunchError
[src]
fn from(kind: LaunchErrorKind) -> LaunchError
Performs the conversion.
impl From<Error> for LaunchError
[src]
impl From<Error> for LaunchError
fn from(error: Error) -> LaunchError
[src]
fn from(error: Error) -> LaunchError
Performs the conversion.
impl From<Error> for LaunchError
[src]
impl From<Error> for LaunchError
fn from(error: Error) -> LaunchError
[src]
fn from(error: Error) -> LaunchError
Performs the conversion.
impl Debug for LaunchError
[src]
impl Debug for LaunchError
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for LaunchError
[src]
impl Display for LaunchError
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Error for LaunchError
[src]
impl Error for LaunchError
fn description(&self) -> &str
[src]
fn description(&self) -> &str
This method is soft-deprecated. Read more
fn cause(&self) -> Option<&Error>
1.0.0[src]
fn cause(&self) -> Option<&Error>
The lower-level cause of this error, if any. Read more
impl Drop for LaunchError
[src]
impl Drop for LaunchError
Auto Trait Implementations
impl Send for LaunchError
impl Send for LaunchError
impl Sync for LaunchError
impl Sync for LaunchError
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow(&self) -> &T
[src]
fn borrow(&self) -> &T
Immutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Typeable for T where
T: Any,
[src]
impl<T> Typeable for T where
T: Any,