[][src]Struct factom::Response

pub struct Response {
    pub jsonrpc: String,
    pub id: u32,
    pub result: Outcome,
}

JSON responses are deserialized into this struct

Fields

jsonrpc: Stringid: u32result: Outcome

Methods

impl Response[src]

pub fn success(self) -> bool[src]

Returns a boolean indicating whether the server sucessfully processed the request

Example

use factom::*;

let factom = Factom::from_host("192.168.121.133");
let query = factom.properties()
                    .map(|response| response)
                    .map_err(|err| err);
let response = fetch(query).unwrap();
if response.success(){
    // it's working
};

pub fn get_result(self) -> Result<Value, FactomError>[src]

Returns a Result type containing either the successful API call result or a FactomError enum

Example

use factom::*;
use errors::FactomError;

let factom = Factom::from_host("192.168.121.133");
let query = factom.factoid_block("Not_a_valid_keymr")
                    .map(|response| response)
                    .map_err(|err| err);
let response = fetch(query).unwrap();
let result = response.get_result();
assert!(result == Err(FactomError::InvalidParams))

Trait Implementations

impl PartialEq<Response> for Response[src]

impl Debug for Response[src]

impl<'de> Deserialize<'de> for Response[src]

Auto Trait Implementations

impl Send for Response

impl Sync for Response

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]