-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct
uom
feature hygiene in macro generated code.
Add macros to condtionally include contents based on features `uom` was compiled with rather then features in the destination crate. Resolves #98 and #100.
- Loading branch information
1 parent
a843283
commit 73075f4
Showing
4 changed files
with
182 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#[macro_export] | ||
#[cfg(feature = "autoconvert")] | ||
macro_rules! autoconvert { | ||
($($tt:tt)*) => { $($tt)* }; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(not(feature = "autoconvert"))] | ||
macro_rules! autoconvert { | ||
($($tt:tt)*) => {}; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(any(feature = "autoconvert", test))] | ||
macro_rules! autoconvert_test { | ||
($($tt:tt)*) => { $($tt)* }; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(not(any(feature = "autoconvert", test)))] | ||
macro_rules! autoconvert_test { | ||
($($tt:tt)*) => {}; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(feature = "autoconvert")] | ||
macro_rules! not_autoconvert { | ||
($($tt:tt)*) => {}; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(not(feature = "autoconvert"))] | ||
macro_rules! not_autoconvert { | ||
($($tt:tt)*) => { $($tt)* }; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(feature = "serde")] | ||
macro_rules! serde { | ||
($($tt:tt)*) => { $($tt)* }; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(not(feature = "serde"))] | ||
macro_rules! serde { | ||
($($tt:tt)*) => {}; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(feature = "si")] | ||
macro_rules! si { | ||
($($tt:tt)*) => { $($tt)* }; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(not(feature = "si"))] | ||
macro_rules! si { | ||
($($tt:tt)*) => {}; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(feature = "std")] | ||
macro_rules! std { | ||
($($tt:tt)*) => { $($tt)* }; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(not(feature = "std"))] | ||
macro_rules! std { | ||
($($tt:tt)*) => {}; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(test)] | ||
macro_rules! test { | ||
($($tt:tt)*) => { $($tt)* }; | ||
} | ||
|
||
#[macro_export] | ||
#[cfg(not(test))] | ||
macro_rules! test { | ||
($($tt:tt)*) => {}; | ||
} |
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 |
---|---|---|
|
@@ -247,6 +247,9 @@ pub mod num { | |
} | ||
} | ||
|
||
#[macro_use] | ||
mod features; | ||
|
||
#[macro_use] | ||
mod storage_types; | ||
|
||
|
Oops, something went wrong.