Macro polymorphic_constant::polymorphic_constant[][src]

macro_rules! polymorphic_constant {
    ($(#[$attr:meta])* ($($vis:tt)*) static $name:ident : $( $numeric_type:ident )|* = $lit:literal; $($nextLine:tt)*) => { ... };
    ($(#[$attr:meta])* static $($t:tt)*) => { ... };
    ($(#[$attr:meta])* pub static $($t:tt)*) => { ... };
    ($(#[$attr:meta])* pub ($($vis:tt)+) static $($t:tt)*) => { ... };
    () => { ... };
}

Define one or more polymorphic numerical constants.

  • A constant X of value 10, available in i32 and u32 will read:
polymorphic_constant! {
    static X: i32 | u32 = 10;
}

and be accessed as:

let x_f32 = X.f32;