Skip to main content

vdict

Macro vdict 

macro_rules! vdict {
    ($($key:expr => $value:expr_2021),* $(,)?) => { ... };
    ($($key:tt: $value:expr),* $(,)?) => { ... };
}
Expand description

Constructs VarDictionary literals, close to Godot’s own syntax.

Keys and values need to implement AsArg<Variant>.

§Example

use godot::builtin::{vdict, Variant};

let key = "my_key";
let d = vdict! {
    "key1" => 10,
    "another" => &Variant::nil(),
    key => true,
    1 + 2 => "final",
};

§See also

For typed dictionaries, use dict!. For arrays, similar macros array! and varray! exist.