[][src]Macro uom::storage_types

macro_rules! storage_types {
    ($(#[$attr:meta])* types: $($T:ident),+; $($tt:tt)*) => { ... };
    ($(#[$attr:meta])* pub types: $($T:ident),+; $($tt:tt)*) => { ... };
    (@types $attr:tt @$M:ident $($T:ident),+; $tt:tt) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident usize ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident u8 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident u16 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident u32 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident u64 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident u128 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident isize ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident i8 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident i16 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident i32 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident i64 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident i128 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident BigInt ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident BigUint ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident Rational ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident Rational32 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident Rational64 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident BigRational ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident f32 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident f64 ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident All ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident PrimInt ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident Ratio ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident Float ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident Signed ($($tt:tt)*)) => { ... };
    (@type ($(#[$attr:meta])*) @$M:ident Unsigned ($($tt:tt)*)) => { ... };
    (@mod ($(#[$attr:meta])*) $M:ident, $V:ty; ($($tt:tt)*)) => { ... };
    (@pub_mod ($(#[$attr:meta])*) $M:ident, $V:ty; ($($tt:tt)*)) => { ... };
    ($($tt:tt)*) => { ... };
}

Macro to duplicate code on a per-storage type basis. The given code is duplicated in new modules named for each storage type. A type alias, V, is generated that code can use for the type. @... match arms are considered private.

#[macro_use]
extern crate uom;

fn main() {
   f32::do_work(1.234_f32);
   f64::do_work(1.234_f64);
}

storage_types! {
   /// Type modules.
   pub types: Float;

   pub fn do_work(_v: V) {}
}