Crate fixerio [] [src]

Fixerio API Wrapper

http://fixer.io

Usage

Add the following to Cargo.toml:

[dependencies]
fixerio = "0.1.2"

Synchronous example:

extern crate fixerio;

use fixerio::{Config, Currency, SyncApi};

fn main() {
    let api = SyncApi::new().expect("Error creating API");

    let config = Config::new(Currency::USD);
    let rates = api.get(&config).expect("Error retrieving rates");

    println!("{:?}", rates);
}

Asynchronous example:

extern crate fixerio;
extern crate tokio_core;

use fixerio::{Config, Currency, AsyncApi};
use tokio_core::reactor::Core;

fn main() {
    let mut core = Core::new().expect("Error creating core");
    let handle = core.handle();

    let api = AsyncApi::new(&handle);

    let config = Config::new(Currency::USD);
    let work = api.get(&config);

    println!("{:?}", core.run(work).expect("Error retrieving rates"));
}

Structs

AsyncApi

Asynchronous API for sending requests

Config

Configuration for requests.

Error

The Error type.

Exchange

The response from fixerio.

FixerioFuture

A future that resolves into a Fixerio response.

Rates

The exchange rates for the base currency within the response.

SyncApi

Synchronous API for sending requests.

Enums

Currency

Fixerio currency.

ErrorKind

The kind of an error.