Macro lu_packets::lnv
source · [−]macro_rules! lnv {
{} => { ... };
{$($name:literal:$value:expr,)*} => { ... };
}
Expand description
Creates a LuNameValue
containing the arguments.
The syntax is name: value
, where name
is a string literal that will be converted to a LuVarWString<u32>
, and value
is an expression that will be converted to an LnvValue
.
Example:
lnv! {
"wstring": "string expression",
"i32": 42i32,
"f32": 3.14f32,
"f64": 3.14f64,
"u32": 42u32,
"bool": true,
"i64": i64::MAX,
"u64": u64::MAX,
"string": b"byte slice",
};
Care should be taken with integer and float literals to suffix them with the correct type, as seen above. Rust assumes i32
for integer and f64
for float literals by default, which may not be what you want, and can lead to incorrect serialization.