Skip to main content

empty

Attribute Macro empty 

Source
#[empty]
Expand description

Declares an empty type for an impl block that does not yet have a corresponding type declaration.

By default the type is a private uninhabited enum. The arguments accept an optional visibility followed by enum, unit, or struct.

ยงExample

#[mkutils_macros::empty]
impl Never {
    const NAME: &'static str = "never";
}

#[mkutils_macros::empty(pub unit_struct)]
impl Unit {}

#[mkutils_macros::empty(pub(crate) c_struct)]
impl Braced {}

let _unit = Unit;
let _braced = Braced {};
std::assert_eq!(Never::NAME, "never");