Skip to content

Instantly share code, notes, and snippets.

@withoutboats
Created May 17, 2017 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save withoutboats/4f554a9c24cc4604eed5c3ad20273d0e to your computer and use it in GitHub Desktop.
Save withoutboats/4f554a9c24cc4604eed5c3ad20273d0e to your computer and use it in GitHub Desktop.
#[macro_use] extern crate cargonauts;
use cargonauts::futures::{Future, future};
use cargonauts::resources::{Resource, Environment, Error};
use cargonauts::methods::Get;
use cargonauts::formats::Debug;
routes! {
resource Echo {
method Get in Debug;
}
}
#[derive(Debug)]
struct Echo(String);
impl Resource for Echo {
type Identifier = String;
}
impl Get for Echo {
fn get(id: String, _: &mut Environment) -> Box<Future<Item = Echo, Error = Error>> {
Box::new(future::ok(Echo(id)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment