Skip to content

Instantly share code, notes, and snippets.

@pop
Created February 8, 2019 23:43
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 pop/09b464dd60b0fde7e19dc77713008f01 to your computer and use it in GitHub Desktop.
Save pop/09b464dd60b0fde7e19dc77713008f01 to your computer and use it in GitHub Desktop.
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate rocket;
extern crate rocket_contrib;
use rocket::State;
#[derive(Debug)]
pub struct Foo {
a: String
}
pub trait Bar: Send + Sync + std::fmt::Debug { }
impl Bar for Foo { }
fn main() {
let d = Box::new(Foo{ a: String::from("a") });
rocket::ignite()
.mount("/", routes![dummy])
.manage(d)
.launch();
}
#[get("/")]
pub fn dummy(state: State<Box<Bar>>) -> () {
dbg!(state);
unimplemented!()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment