[−][src]Struct factom::Response
JSON responses are deserialized into this struct
Fields
jsonrpc: String
id: u32
result: 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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
ⓘImportant traits for &'_ mut Rfn borrow_mut(&mut self) -> &mut T
[src]
ⓘImportant traits for &'_ mut R
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,