#iron #http #http-header #hyper #rest

nightly austenite

A library for building Iron handlers that implements HTTP header handling and content negotiation

1 unstable release

Uses old Rust 2015

0.0.1 Feb 9, 2015

#73 in #iron

64KB
1.5K SLoC

Austenite

A library for building Iron handlers that implements HTTP header handling and content negotiation.

A port of Clojure's Liberator library, itself inspired by Erlang's webmachine.

Install

Add austenite = "*" to your Cargo.toml dependencies.

Usage

struct GetOkContent;
resource_handler!(GetOkContent);

impl Resource for GetOkContent {
    fn handle_ok(&self, req: &Request, resp: &mut Response)
               -> IronResult<Response>
    {
      resp.set_mut((status::Ok, "hello"));
      Ok(Response::new())
    }
}Iron::new(Resource).listen((address,0u16));

License

TBD


lib.rs:

Austenite

A library for building Iron handlers that implements HTTP header handling and content negotiation.

#[macro_use] extern crate austenite;
use austenite::handle;
use iron::{Iron, Listening, Request, Response};

struct GetOkContent;
resource_handler!(GetOkContent);
impl Resource for GetOkContent {
    fn handle_ok(&self, req: &Request, resp: &mut Response)
               -> IronResult<Response>
    {
      resp.set_mut((status::Ok, "hello"));
      Ok(Response::new())
    }
}

fn start_iron() -> Listening {
  Iron::new(Resource).listen((address,0u16)).unwrap();
}

Dependencies

~7–13MB
~152K SLoC