Macro fluid_let::fluid_let

source ·
macro_rules! fluid_let {
    {
        $(#[$attr:meta])*
        $pub:vis static $name:ident: $type:ty
    } => { ... };
    {
        $(#[$attr:meta])*
        $pub:vis static $name:ident: $type:ty = $value:expr
    } => { ... };
    {
        $(#[$attr:meta])*
        $pub:vis static $name:ident: $type:ty;
        $($rest:tt)*
    } => { ... };
    {
        $(#[$attr:meta])*
        $pub:vis static $name:ident: $type:ty = $value:expr;
        $($rest:tt)*
    } => { ... };
    {} => { ... };
}
Expand description

Declares global dynamic variables.

Examples

One-line form for single declarations:

fluid_let!(static ENABLED: bool);

Multiple declarations with attributes and visibility modifiers are also supported:

fluid_let! {
    /// Length of `Debug` representation of hashes in characters.
    pub static HASH_LENGTH: usize;

    /// If set to true then passwords will be printed to logs.
    #[cfg(test)]
    static DUMP_PASSWORDS: bool;
}

See also crate-level documentation for usage examples.