Struct couchdb::Nok
[−]
[src]
pub struct Nok { pub error: String, pub reason: String, // some fields omitted }
Nok
contains the content of an error response from the CouchDB server.
Summary
Nok
has public members instead of accessor methods because there are no invariants restricting the data.Nok
implementsDeserialize
.
Remarks
When the CouchDB server responds with a 4xx- or 5xx status code, the response usually has a body containing a JSON object with an “error” string and a “reason” string. For example:
{
"error": "file_exists",
"reason": "The database could not be created, the file already exists."
}
The Nok
type contains the information from the response body.
extern crate couchdb; extern crate serde_json; let nok: couchdb::Nok = serde_json::from_slice(body).unwrap(); assert_eq!(nok.error, "file_exists"); assert_eq!(nok.reason, "The database could not be created, the file already exists.");
Compatibility
Nok
contains a dummy private member in order to prevent applications from
directly constructing a Nok
instance. This allows new fields to be added
to Nok
in future releases without it being a breaking change.
Fields
error: String
reason: String
Trait Implementations
impl Clone for Nok
[src]
fn clone(&self) -> Nok
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Nok
[src]
impl Default for Nok
[src]
impl Eq for Nok
[src]
impl Hash for Nok
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for Nok
[src]
fn cmp(&self, __arg_0: &Nok) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialEq for Nok
[src]
fn eq(&self, __arg_0: &Nok) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Nok) -> bool
This method tests for !=
.
impl PartialOrd for Nok
[src]
fn partial_cmp(&self, __arg_0: &Nok) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Nok) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Nok) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Nok) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Nok) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more