pub struct Inspectable<V, W>where
W: Watch<V>,{ /* private fields */ }
Expand description
Generic wrapper for exporting variables via Inspect. Mutations to
the wrapped value
occur through an InspectableGuard
, which
notifies the watcher
when Drop
ped, transparently keeping the Inspect
state up-to-date.
How the value
is exported is determined by the Watch
implementation,
see e.g. InspectableDebugString
.
Not correct for V
s with interior mutability, because Inspectable
Deref
s to V
, mutations to which will bypass the watcher
.
Implementations§
Source§impl<V, W> Inspectable<V, W>where
W: Watch<V>,
impl<V, W> Inspectable<V, W>where
W: Watch<V>,
Sourcepub fn new(value: V, node: &Node, name: impl Into<StringReference>) -> Self
pub fn new(value: V, node: &Node, name: impl Into<StringReference>) -> Self
Creates an Inspectable
wrapping value
. Exports value
via Inspect.
Sourcepub fn get_mut(&mut self) -> InspectableGuard<'_, V, W>
pub fn get_mut(&mut self) -> InspectableGuard<'_, V, W>
Returns a guard that DerefMut
s to the wrapped value
. The watcher
will receive the updated value
when the guard is Drop
ped.
Trait Implementations§
Source§impl<V, W> Borrow<V> for Inspectable<V, W>where
W: Watch<V>,
impl<V, W> Borrow<V> for Inspectable<V, W>where
W: Watch<V>,
Source§impl<V, W> Debug for Inspectable<V, W>
impl<V, W> Debug for Inspectable<V, W>
Source§impl<V, W> Deref for Inspectable<V, W>where
W: Watch<V>,
impl<V, W> Deref for Inspectable<V, W>where
W: Watch<V>,
Source§impl<V, W> PartialEq for Inspectable<V, W>
impl<V, W> PartialEq for Inspectable<V, W>
impl<V, W> Eq for Inspectable<V, W>
Auto Trait Implementations§
impl<V, W> Freeze for Inspectable<V, W>
impl<V, W> RefUnwindSafe for Inspectable<V, W>where
V: RefUnwindSafe,
W: RefUnwindSafe,
impl<V, W> Send for Inspectable<V, W>
impl<V, W> Sync for Inspectable<V, W>
impl<V, W> Unpin for Inspectable<V, W>
impl<V, W> UnwindSafe for Inspectable<V, W>where
V: UnwindSafe,
W: 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