Skip to main content

val

Macro val 

Source
macro_rules! val {
    ($value:expr) => { ... };
}
Expand description

A macro to create a Value from a given expression.

This macro simplifies the creation of Value instances by automatically converting the provided expression into a Value using the From trait.

ยงExamples

use nitrite::common::Value;
use nitrite::val;

let int_value = val!(42);
assert_eq!(int_value, Value::I32(42));

let string_value = val!("hello");
assert_eq!(string_value, Value::String("hello".to_string()));

let bool_value = val!(true);
assert_eq!(bool_value, Value::Bool(true));