1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
#![feature(proc_macro_diagnostic)] #![recursion_limit="256"] //! # Rocket-Config - Code Generation //! //! This crate implements the code generation portions of Rocket-config. //! This includes procedural macros. //! //! ## Procedural Macros //! //! This crate implements the following procedural macros: //! //! * **configuration** //! //! The syntax for the `configuration` macro is: //! //! <pre> //! macro := configuration!(CONFIGURATION_FILE_STEM) //! </pre> //! //! ## Usage //! //! You **_should not_** directly depend on this library. To use the macros, //! it suffices to depend on `rocket-config` in `Cargo.toml`: //! //! ```toml //! [dependencies] //! rocket-config = "0.0.1" //! ``` //! //! And to import the macros via `#[macro_use]` in the crate root: //! //! ```rust //! #![feature(proc_macro_hygiene, decl_macro)] //! //! #[macro_use] extern crate rocket_config; //! //! configuration!("test"); //! //! // ... //! ``` //! //! Or, alternatively, selectively import from the top-level scope: //! //! ```rust //! #![feature(proc_macro_hygiene, decl_macro)] //! //! extern crate rocket_config; //! //! use rocket_config::configuration; //! //! configuration!("test"); //! //! // ... //! ``` #![warn(rust_2018_idioms)] #[macro_use] extern crate quote; extern crate proc_macro; mod configuration; #[allow(unused_imports)] use proc_macro::TokenStream; /// The procedural macro for the `configuration` function-like macro. #[proc_macro] pub fn configuration(input: TokenStream) -> TokenStream { configuration::configuration_function(input) }