Struct gotham_restful::Success
source · [−]pub struct Success<T> { /* private fields */ }
Expand description
This can be returned from a resource when there is no cause of an error.
Usage example:
#[derive(Deserialize, Serialize)]
struct MyResponse {
message: &'static str
}
#[read_all]
fn read_all() -> Success<MyResponse> {
let res = MyResponse { message: "I'm always happy" };
res.into()
}
Implementations
sourceimpl<T> Success<T>
impl<T> Success<T>
sourcepub fn header<K: IntoHeaderName>(&mut self, name: K, value: HeaderValue)
pub fn header<K: IntoHeaderName>(&mut self, name: K, value: HeaderValue)
Set a custom HTTP header. If a header with this name was set before, its value is being updated.
sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Allow manipulating HTTP headers.
Trait Implementations
sourceimpl<T: ResponseBody> IntoResponse for Success<T>
impl<T: ResponseBody> IntoResponse for Success<T>
type Err = Error
sourcefn into_response(
self
) -> Pin<Box<dyn Future<Output = Result<Response, Self::Err>> + Send>>
fn into_response(
self
) -> Pin<Box<dyn Future<Output = Result<Response, Self::Err>> + Send>>
Turn this into a response that can be returned to the browser. This api will likely change in the future. Read more
sourcefn accepted_types() -> Option<Vec<Mime>>
fn accepted_types() -> Option<Vec<Mime>>
Return a list of supported mime types.
sourceimpl<T: ResponseBody> ResponseSchema for Success<T>
impl<T: ResponseBody> ResponseSchema for Success<T>
sourcefn schema(code: StatusCode) -> OpenapiSchema
fn schema(code: StatusCode) -> OpenapiSchema
Return the schema of the response for the given status code. The code may only be one that was previously returned by Self::status_codes. The implementation should panic if that is not the case. Read more
sourcefn status_codes() -> Vec<StatusCode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn status_codes() -> Vec<StatusCode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
All status codes returned by this response. Returns [StatusCode::OK]
by default.
Auto Trait Implementations
impl<T> RefUnwindSafe for Success<T> where
T: RefUnwindSafe,
impl<T> Send for Success<T> where
T: Send,
impl<T> Sync for Success<T> where
T: Sync,
impl<T> Unpin for Success<T> where
T: Unpin,
impl<T> UnwindSafe for Success<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
Convert self
to an expression for Diesel’s query builder. Read more
sourcefn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self
to an expression for Diesel’s query builder. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more