mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-02-23 13:02:28 +00:00
weird proc macro issue
This commit is contained in:
parent
df3b735429
commit
2c31251cb2
3 changed files with 6 additions and 10 deletions
|
@ -70,6 +70,9 @@ OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS LICENSE.
|
||||||
[serde_json]: https://github.com/serde-rs/json#serde-json----
|
[serde_json]: https://github.com/serde-rs/json#serde-json----
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// weird proc macro issue
|
||||||
|
extern crate self as gotham_restful;
|
||||||
|
|
||||||
#[macro_use] extern crate gotham_derive;
|
#[macro_use] extern crate gotham_derive;
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use] extern crate serde;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ This can be returned from a resource when there is no cause of an error. For exa
|
||||||
```
|
```
|
||||||
# #[macro_use] extern crate gotham_restful_derive;
|
# #[macro_use] extern crate gotham_restful_derive;
|
||||||
# use gotham::state::State;
|
# use gotham::state::State;
|
||||||
# use gotham_restful::Success;
|
# use gotham_restful::*;
|
||||||
# use serde::{Deserialize, Serialize};
|
# use serde::{Deserialize, Serialize};
|
||||||
#
|
#
|
||||||
# #[derive(Resource)]
|
# #[derive(Resource)]
|
||||||
|
@ -125,6 +125,7 @@ the function attributes:
|
||||||
```
|
```
|
||||||
# #[macro_use] extern crate gotham_restful_derive;
|
# #[macro_use] extern crate gotham_restful_derive;
|
||||||
# use gotham::state::State;
|
# use gotham::state::State;
|
||||||
|
# use gotham_restful::*;
|
||||||
#
|
#
|
||||||
# #[derive(Resource)]
|
# #[derive(Resource)]
|
||||||
# struct MyResource;
|
# struct MyResource;
|
||||||
|
|
|
@ -3,7 +3,6 @@ extern crate proc_macro;
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use proc_macro2::TokenStream as TokenStream2;
|
use proc_macro2::TokenStream as TokenStream2;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use std::env;
|
|
||||||
|
|
||||||
mod method;
|
mod method;
|
||||||
use method::{expand_method, Method};
|
use method::{expand_method, Method};
|
||||||
|
@ -13,16 +12,9 @@ use resource::expand_resource;
|
||||||
mod openapi_type;
|
mod openapi_type;
|
||||||
|
|
||||||
fn krate() -> TokenStream2
|
fn krate() -> TokenStream2
|
||||||
{
|
|
||||||
if env::var("CARGO_PKG_NAME").unwrap() == "gotham_restful"
|
|
||||||
{
|
|
||||||
quote!(crate)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
quote!(::gotham_restful)
|
quote!(::gotham_restful)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "openapi")]
|
#[cfg(feature = "openapi")]
|
||||||
#[proc_macro_derive(OpenapiType)]
|
#[proc_macro_derive(OpenapiType)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue