oversized_box

Macro coerce

Source
macro_rules! coerce {
    ($e:expr) => { ... };
}
Expand description

Coerces an oversized box.

This is necessary because std::ops::CoerceUnsized is not stable.

§Example

let x = OversizedBox::<_, u64>::new(5u32);
let y: OversizedBox<dyn Send, u64> = oversized_box::coerce!(x);

You cannot use this to change the storage type. This will fail to build.

let x = OversizedBox::<_, u64>::new(5u32);
let y: OversizedBox<dyn Send, u32> = oversized_box::coerce!(x);