pub const fn wrap<Outer, Inner>(val: Inner) -> Outerwhere
Outer: TransparentWrapper<Inner>,Expand description
Casts Inner to Outer
ยงExample
use constmuck::wrapper;
#[derive(Debug, PartialEq, constmuck::TransparentWrapper)]
#[repr(transparent)]
pub struct Qux<T>(pub T);
// Casting `u32` to `Qux<u32>`
const VALUE: Qux<u32> = wrapper::wrap(3);
assert_eq!(VALUE, Qux(3));
// the `::<Qux<_>, _>` is required because any type can implement comparison with `Qux`.
assert_eq!(wrapper::wrap::<Qux<_>, _>(3), Qux(3));