anterofit
Anterofit is a collection of Rust macros coupled to a lightweight, self-contained HTTP framework that allows you to create strongly-typed Rust wrappers around REST APIs with ease.
// See examples/post_service.rs for more details
extern crate anterofit;
extern crate rustc_serialize;
use ;
service!
/// Create a new Post.
// All service traits are implemented for `Adapter` by default; using generics like this promotes good namespacing.
/// Fetch the top 3 posts in the database.
// Service traits are object-safe by default
Inspired by Square's Retrofit, as referenced in the name, Anterofit is even more strongly typed as everything that is feasible to check at compile-time, is. Runtime errors are, with few exceptions, reserved for error conditions that can only be discovered at runtime.
Usage
Get started with our User Guide
Or an in-depth look with our Documentation
###Setup
Serde and JSON serialization:
Enabled by default with the serde-all
feature.
Cargo.toml
:
[]
= "0.1"
# `serde` is required in the dependencies but not in the crate root.
= "0.9"
= "0.9"
Crate Root:
extern crate anterofit;
extern crate serde_derive;
####rustc-serialize
:
Cargo.toml
:
[]
= "0.3"
[]
= "0.1"
= false
= ["rustc-serialize"]
Crate Root:
extern crate anterofit;
extern crate rustc_serialize;
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.