[−][src]Struct http_types::Error
The error type for HTTP operations.
Implementations
impl Error
[src]
pub fn new<S, E>(status: S, error: E) -> Self where
S: TryInto<StatusCode>,
S::Error: Debug,
E: Into<Error>,
[src]
S: TryInto<StatusCode>,
S::Error: Debug,
E: Into<Error>,
Create a new error object from any error type.
The error type must be threadsafe and 'static, so that the Error will be as well. If the error type does not provide a backtrace, a backtrace will be created here to ensure that a backtrace exists.
pub fn from_str<S, M>(status: S, msg: M) -> Self where
S: TryInto<StatusCode>,
S::Error: Debug,
M: Display + Debug + Send + Sync + 'static,
[src]
S: TryInto<StatusCode>,
S::Error: Debug,
M: Display + Debug + Send + Sync + 'static,
Create a new error object from static string.
pub fn status(&self) -> StatusCode
[src]
Get the status code associated with this error.
pub fn set_status<S>(&mut self, status: S) where
S: TryInto<StatusCode>,
S::Error: Debug,
[src]
S: TryInto<StatusCode>,
S::Error: Debug,
Set the status code associated with this error.
pub fn backtrace(&self) -> Option<&Backtrace>
[src]
Get the backtrace for this Error.
Backtraces are only available on the nightly channel. Tracking issue: rust-lang/rust#53487.
In order for the backtrace to be meaningful, the environment variable
RUST_LIB_BACKTRACE=1
must be defined. Backtraces are somewhat
expensive to capture in Rust, so we don't necessarily want to be
capturing them all over the place all the time.
Note: This function can be called whether or not backtraces
are enabled and available. It will return a None
variant if
compiled on a toolchain that does not support backtraces, or
if executed without backtraces enabled with
RUST_LIB_BACKTRACE=1
.
pub fn into_inner(self) -> Error
[src]
Returns the inner anyhow::Error
Note: This will lose status code information
pub fn downcast<E>(self) -> Result<E, Self> where
E: Display + Debug + Send + Sync + 'static,
[src]
E: Display + Debug + Send + Sync + 'static,
Attempt to downcast the error object to a concrete type.
pub fn downcast_ref<E>(&self) -> Option<&E> where
E: Display + Debug + Send + Sync + 'static,
[src]
E: Display + Debug + Send + Sync + 'static,
Downcast this error object by reference.
pub fn downcast_mut<E>(&mut self) -> Option<&mut E> where
E: Display + Debug + Send + Sync + 'static,
[src]
E: Display + Debug + Send + Sync + 'static,
Downcast this error object by mutable reference.
pub fn type_name(&self) -> Option<&str>
[src]
Retrieves a reference to the type name of the error, if available.
Trait Implementations
impl AsMut<StatusCode> for Error
[src]
pub fn as_mut(&mut self) -> &mut StatusCode
[src]
impl AsRef<StatusCode> for Error
[src]
pub fn as_ref(&self) -> &StatusCode
[src]
impl AsRef<dyn Error + 'static + Send + Sync> for Error
[src]
impl AsRef<dyn Error + 'static> for Error
[src]
impl Debug for Error
[src]
impl Display for Error
[src]
impl<E: Into<Error>> From<E> for Error
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Error
[src]
impl Send for Error
[src]
impl Sync for Error
[src]
impl Unpin for Error
[src]
impl !UnwindSafe for Error
[src]
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,
pub 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> Same<T> for T
type Output = T
Should always be Self
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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,