Created
May 17, 2017 00:44
-
-
Save withoutboats/bd91286a1c04f170532f1f83bd5ca513 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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