pub struct Visit<F: FnMut(&mut dyn FnMut(&mut dyn INode))>(pub F);Expand description
Node visitor from closure.
The visitor trait IVisit requires a struct type to be implemented.
This wrapper type allows a visitor to be created out of a closure instead.
let mut value = 0;
let mut visitor = cvar::Visit(|f| {
f(&mut cvar::Property("value", &mut value, &0));
});
let mut writer = String::new();
let _ = cvar::console::set(&mut visitor, "value", "42", &mut writer);
assert_eq!(value, 42);Tuple Fields§
§0: FTrait Implementations§
impl<F: Copy + FnMut(&mut dyn FnMut(&mut dyn INode))> Copy for Visit<F>
Auto Trait Implementations§
impl<F> Freeze for Visit<F>where
F: Freeze,
impl<F> RefUnwindSafe for Visit<F>where
F: RefUnwindSafe,
impl<F> Send for Visit<F>where
F: Send,
impl<F> Sync for Visit<F>where
F: Sync,
impl<F> Unpin for Visit<F>where
F: Unpin,
impl<F> UnwindSafe for Visit<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more