Enum xio_webapi::Response [−][src]
pub enum Response<T: Default + MayBeSkipped> { Ok { data: T, }, Error { message: String, }, }
A message wrapping the response of a XIO Web API request.
Variants
Ok
A success response, optionally containing data.
Fields of Ok
data: T | The data embedded in the response. |
Error
An error response.
Fields of Error
message: String | A message describing the error. |
Methods
impl<T: Default + MayBeSkipped> Response<T>
[src]
impl<T: Default + MayBeSkipped> Response<T>
pub fn ok(data: T) -> Self
[src]
pub fn ok(data: T) -> Self
Build a successful response.
pub fn error<E>(error: E) -> Self where
E: Display,
[src]
pub fn error<E>(error: E) -> Self where
E: Display,
Build an error response.
Trait Implementations
impl<T: Clone + Default + MayBeSkipped> Clone for Response<T>
[src]
impl<T: Clone + Default + MayBeSkipped> Clone for Response<T>
fn clone(&self) -> Response<T>
[src]
fn clone(&self) -> Response<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl<T: Debug + Default + MayBeSkipped> Debug for Response<T>
[src]
impl<T: Debug + Default + MayBeSkipped> Debug for Response<T>
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<T: PartialEq + Default + MayBeSkipped> PartialEq for Response<T>
[src]
impl<T: PartialEq + Default + MayBeSkipped> PartialEq for Response<T>
fn eq(&self, other: &Response<T>) -> bool
[src]
fn eq(&self, other: &Response<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Response<T>) -> bool
[src]
fn ne(&self, other: &Response<T>) -> bool
This method tests for !=
.
impl<T: Eq + Default + MayBeSkipped> Eq for Response<T>
[src]
impl<T: Eq + Default + MayBeSkipped> Eq for Response<T>