Struct dazeus::Response [] [src]

pub struct Response {
    // some fields omitted
}

The response from a command send to the DaZeus server.

Methods

impl Response

fn for_fail(msg: &str) -> Response

Create a new response based upon a failure message.

This is used where the API expected a response returned but the DaZeus core could not provide a valid response.

fn for_success() -> Response

Create a new response based upon a successful operation.

This is used when the API expected a response, but the DaZeus core was not called.

fn from_json(data: &Json) -> Result<Response, InvalidJsonError>

Create a new response based on a Json object.

This is used by the bindings to create a new Response based on a json blob returned by the DaZeus core instance.

fn get_or<'a>(&'a self, prop: &'a str, default: &'a Json) -> &'a Json

Retrieve a property from the data object or return a default if it doesn't exist.

fn get<'a>(&'a self, prop: &'a str) -> Option<&'a Json>

Retrieve a property from the data object.

Returns Some(data) if the property exists, or None if the property doesn't exist.

fn get_str<'a>(&'a self, prop: &'a str) -> Option<&'a str>

Retrieve a string from the data object.

Returns Some(str) if the property exists and it was a string property, or None if the property doesn't exist, or if it isn't of type Json::String.

fn get_str_or<'a>(&'a self, prop: &'a str, default: &'a str) -> &'a str

Retrieve a string from the data object, or return a default if no such string can be found.

fn has(&self, prop: &str) -> bool

Returns whether or not a property with the given name exists.

fn has_success(&self) -> bool

Check whether a Response contains a success property and whether it was true.

Trait Implementations

Derived Implementations

impl PartialEq for Response

fn eq(&self, __arg_0: &Response) -> bool

fn ne(&self, __arg_0: &Response) -> bool

impl Clone for Response

fn clone(&self) -> Response

fn clone_from(&mut self, source: &Self)

impl Debug for Response

fn fmt(&self, __arg_0: &mut Formatter) -> Result