Skip to content

Instantly share code, notes, and snippets.

@Korvox
Created November 30, 2018 02:55
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 Korvox/521af158c49f1a14ab83155a5448a554 to your computer and use it in GitHub Desktop.
Save Korvox/521af158c49f1a14ab83155a5448a554 to your computer and use it in GitHub Desktop.
Gets cannot find `__req` & '__data' in this scope errors
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
macro_rules! index {
($type:ty) => {
#[get("/")]
fn index(thing: rocket::State<$type>) -> String {
format!("Thing: {}", *thing)
}
}
}
index!(i32);
fn main() {
rocket::ignite().manage::<i32>(42).mount("/", routes![index]).launch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment