Macro constmuck::infer [−][src]
macro_rules! infer {
() => { ... };
($ty : ty) => { ... };
}
Expand description
For constructing types that implement Infer
, this includes Impls*
types.
Example
use constmuck::{cast, infer};
use constmuck::{ImplsPod, ImplsTransparentWrapper};
use std::num::Wrapping;
const ARR: [u8; 4] = cast([-3i8, -2, -1, 0], infer!());
assert_eq!(ARR, [253, 254, 255, 0]);
const fn requires_pod<T>(_bounds: ImplsPod<T>) {}
requires_pod::<u32>(infer!());
// the same as the above call
requires_pod(infer!(ImplsPod<u32>));
const fn requires_2_bounds<T, U>(_bounds: (ImplsPod<T>, ImplsTransparentWrapper<U, T>)) {}
requires_2_bounds::<u32, Wrapping<u32>>(infer!());
// the same as the above call
requires_2_bounds(infer!((ImplsPod<u32>, ImplsTransparentWrapper<Wrapping<u32>, u32>)));