[−][src]Struct nebula_status::Status
An HTTP status code bundled with associated data.
Code that creates a new instance of Status should set any related response headers before returning it.
Implementations
impl Status
[src]
pub fn new(code: StatusCode) -> Status<Empty>
[src]
Create a new Status without any associated data. This will be converted to the specified status code with associated headers and no body.
pub fn with_message(code: StatusCode, msg: String) -> Status<String>
[src]
Create a new Status with associated data of type String. Useful for returning basic error messages.
pub fn with_data<T: StatusData>(code: StatusCode, data: T) -> Status<T>
[src]
Create a new Status with associated arbitrary data. Useful for returning a struct that can be serialized into e.g. JSON.
impl<T: StatusData> Status<T>
[src]
pub fn code(&self) -> &StatusCode
[src]
Gain a reference to this Status' status code.
pub fn message(&self) -> Option<&str>
[src]
Attempts to parse the data contained in this Status as a &str.
The Content-Type
header is used to help determine if the data is meant
to be parsed as text or not.
pub fn data(&self) -> &T
[src]
Returns a reference to the contained data.
pub fn bytes(&self) -> &[u8]
[src]
pub fn headers(&self) -> &HeaderMap<HeaderValue>
[src]
Gain an immutable view into the headers map.
pub fn headers_mut(&mut self) -> &mut HeaderMap<HeaderValue>
[src]
Gain a mutable reference to the headers map.
Trait Implementations
impl<T: Clone> Clone for Status<T> where
T: StatusData,
[src]
T: StatusData,
impl<T: Debug> Debug for Status<T> where
T: StatusData,
[src]
T: StatusData,
impl<T: StatusData> Display for Status<T>
[src]
impl<T: Eq> Eq for Status<T> where
T: StatusData,
[src]
T: StatusData,
impl<T: StatusData> Error for Status<T>
[src]
fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
fn backtrace(&self) -> Option<&Backtrace>
[src]
fn description(&self) -> &str
1.0.0[src]
fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl<T: StatusData> From<Status<T>> for Result<Status<T>, Status<T>>
[src]
impl<T: PartialEq> PartialEq<Status<T>> for Status<T> where
T: StatusData,
[src]
T: StatusData,
impl<T> StructuralEq for Status<T> where
T: StatusData,
[src]
T: StatusData,
impl<T> StructuralPartialEq for Status<T> where
T: StatusData,
[src]
T: StatusData,
Auto Trait Implementations
impl<T> RefUnwindSafe for Status<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Status<T>
impl<T> Sync for Status<T>
impl<T> Unpin for Status<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Status<T> where
T: UnwindSafe,
T: UnwindSafe,
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<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StatusInnerData for T where
T: 'static + Clone + Send + Sync + Debug,
[src]
T: 'static + Clone + Send + Sync + Debug,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,