36 releases

0.3.16 Aug 24, 2018
0.3.15 Jul 16, 2018
0.3.14 Jun 23, 2018
0.3.6 Jan 13, 2018
0.1.3 Dec 31, 2016

#6 in Web programming

Download history 1886/week @ 2018-06-01 2019/week @ 2018-06-08 2106/week @ 2018-06-15 1987/week @ 2018-06-22 3190/week @ 2018-06-29 2762/week @ 2018-07-06 2656/week @ 2018-07-13 2337/week @ 2018-07-20 2335/week @ 2018-07-27 2596/week @ 2018-08-03 2942/week @ 2018-08-10 1856/week @ 2018-08-17 1639/week @ 2018-08-24

10,103 downloads per month
Used in 47 crates (42 directly)

MIT/Apache

663KB
8K SLoC


lib.rs:

Rocket - Code Generation

This crate implements the code generation portions of Rocket. This includes custom derives, custom attributes, and procedural macros. The documentation here is purely technical. The code generation facilities are documented thoroughly in the Rocket programming guide.

Usage

You should not directly depend on this library. To use the macros, attributes, and derives in this crate, it suffices to depend on rocket in Cargo.toml:

[dependencies]
rocket = "0.4.0-rc.1"

And to import all macros, attributes, and derives via #[macro_use] in the crate root:

#![feature(proc_macro_hygiene, decl_macro)]

#[macro_use] extern crate rocket;
# #[get("/")] fn hello() { }
# fn main() { rocket::ignite().mount("/", routes![hello]); }

Or, alternatively, selectively import from the top-level scope:

#![feature(proc_macro_hygiene, decl_macro)]
# extern crate rocket;

use rocket::{get, routes};
# #[get("/")] fn hello() { }
# fn main() { rocket::ignite().mount("/", routes![hello]); }

Debugging Codegen

When the ROCKET_CODEGEN_DEBUG environment variable is set, this crate logs, at compile-time and to the console, the items it generates. For example, you might run the following to build a Rocket application with codegen debug logging enabled:

ROCKET_CODEGEN_DEBUG=1 cargo build

Dependencies

~13MB
~407K SLoC