4 releases
Uses old Rust 2015
0.1.3 | Aug 22, 2017 |
---|---|
0.1.2 | Aug 18, 2017 |
0.1.1 | Jun 25, 2017 |
0.1.0 | Jun 24, 2017 |
#7 in #rates
21KB
374 lines
Fixerio
A Rust wrapper for the Fixerio API (http://fixer.io/).
Installation
Add the following to Cargo.toml
:
[dependencies]
fixerio = "0.1.2"
Usage
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"));
}
Dependencies
~11–18MB
~246K SLoC