Macro constmuck::IsPod [−][src]
macro_rules! IsPod {
() => { ... };
($T : ty) => { ... };
}
Expand description
Constructs an IsPod<$T>
,
requires $T:
Pod
.
This has an optional type argument ($T
) that defaults to
infering the type if not passed.
Example
use constmuck::{IsPod, cast, infer};
// transmuting `i16` to `u16`
const FOO: u16 = cast(-1i16, (IsPod!(), IsPod!()));
const BAR: u16 = cast(-1, (IsPod!(i16), IsPod!(u16)));
// A more concise way to call `constmuck::cast` when the types are inferred.
const BAZ: u16 = cast(-1i16, infer!());
assert_eq!(FOO, u16::MAX);
assert_eq!(BAR, u16::MAX);
assert_eq!(BAZ, u16::MAX);