Skip to main content

lazy_code

Macro lazy_code 

macro_rules! lazy_code {
    ($(#[$meta:meta])* $vis:vis static $name:ident: $ty:ty = $builtin:path, feature = $feature:literal;) => { ... };
}
Expand description

Declare the code of a surface that loads on first use where feature (a feature of the declaring crate) is on, and is linked otherwise:

ⓘ
ui::lazy_code! {
    /// History's code.
    pub(crate) static HISTORY: MakeHistory = builtin_history, feature = "lazy-history";
}

builtin is the only path to the surface’s code: the module that holds it exports it (split_code!), and nothing else may name it.