macro_rules! computed_tuple {
($($arg: tt),*) => { ... };
($($name: ident => $arg: expr),*) => { ... };
}Expand description
Allows to create Computed<T1, T2, ...> out of Value<T1>, Value<T2>, …
§Examples
use vertigo::{Value, computed_tuple};
let value1 = Value::new(true);
let value2 = Value::new(5);
let value3 = Value::new("Hello tuple!".to_string());
let my_tuple = computed_tuple!(value1, value2, value3);
vertigo::transaction(|ctx| {
assert!(my_tuple.get(ctx).0);
assert_eq!(my_tuple.get(ctx).1, 5);
assert_eq!(&my_tuple.get(ctx).2, "Hello tuple!");
});use vertigo::{Value, computed_tuple};
let values = (Value::new(true), Value::new(5));
let value3 = Value::new("Hello tuple!".to_string());
let my_tuple = computed_tuple!(a => values.0, b => values.1, c => value3);
vertigo::transaction(|ctx| {
assert!(my_tuple.get(ctx).0);
assert_eq!(my_tuple.get(ctx).1, 5);
assert_eq!(&my_tuple.get(ctx).2, "Hello tuple!");
});