Skip to main content

constant

Attribute Macro constant 

#[constant]
Expand description

Modifier for const declarations.

§#[constant(eval)]

Try to evaluate the constant before translating it.

Do not use this if the constant contains constructors with private fields.

§In extern specs

This attribute can also be used in extern_spec! to modify external constants:

extern_spec! {
    #[constant(eval)]
    const u64::MAX;
}

Note that the syntax of const in extern_spec! does not have a body (this is not quite Rust syntax).