Skip to main content

flat

Macro flat 

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

Constructs a Flat from a concrete value via unsizing coercion.

The return type must be annotated so the compiler performs unsizing coercion (e.g., Flat<dyn Trait, B32>).

§Panics

Panics if the concrete value doesn’t fit in the buffer (after reserving one pointer-sized word for metadata on ?Sized targets).

§Examples

use nexus_smartptr::{flat, Flat, B32};
use core::fmt::Display;

let f: Flat<dyn Display, B32> = flat!(42_u32);
assert_eq!(format!("{}", &*f), "42");