twelve_bit::u12! [] [src]

macro_rules! u12 {
    ( $x:expr ) => { ... };
}

Creates a 12-bit value via unchecked-into conversion. This is meant to simplify describing U12 literal values, as the $x parameter is first bound to a 16-bit value. This allows the compiler to elide the type of the literal, and does compile-time validation that no literal greater than 0xFFFF is specified; this will panic for values in the range 0x1000...0xFFFF.

Examples

Basic usage:

use twelve_bit::u12::*;
assert_eq!(u12![0], U12::min_value());
assert_eq!(u12![4095], U12::max_value());