Skip to main content

reflect_mut

Macro reflect_mut 

Source
macro_rules! reflect_mut {
    ($($args:tt)*) => { ... };
}
Expand description

Reflect a mutable reference, detecting capabilities with mutable access.

Returns an EnvelopeMut with read + write access to capabilities. The original value remains available after the envelope is dropped.

ยงExample

let mut value = Counter { count: 99 };
{
    let mut envelope_mut = reflect_mut!(&mut value);
    envelope_mut.get_mut::<ResettableCap>().unwrap().reset();
}
assert_eq!(value.count, 0);