-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a02e30
commit b0e24e1
Showing
6 changed files
with
59 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
mod detail; | ||
mod named_type; | ||
mod strong_type; | ||
|
||
use proc_macro::TokenStream; | ||
use syn::{parse_macro_input, DeriveInput}; | ||
|
||
use crate::named_type::expand_named_type; | ||
use crate::strong_type::expand_strong_type; | ||
|
||
#[proc_macro_derive(NamedType, attributes(custom_display))] | ||
pub fn named_type(input: TokenStream) -> TokenStream { | ||
#[proc_macro_derive(StrongType, attributes(custom_display))] | ||
pub fn strong_type(input: TokenStream) -> TokenStream { | ||
let input = parse_macro_input!(input as DeriveInput); | ||
expand_named_type(input, false).into() | ||
expand_strong_type(input, false).into() | ||
} | ||
|
||
#[proc_macro_derive(NamedNumeric, attributes(custom_display))] | ||
pub fn named_numeric(input: TokenStream) -> TokenStream { | ||
#[proc_macro_derive(StrongNumericType, attributes(custom_display))] | ||
pub fn strong_numeric_type(input: TokenStream) -> TokenStream { | ||
let input = parse_macro_input!(input as DeriveInput); | ||
expand_named_type(input, true).into() | ||
expand_strong_type(input, true).into() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
mod named_type; | ||
mod strong_type; |