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 Dropped, 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 Vs with interior mutability, because Inspectable
Derefs 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<'a>(value: V, node: &Node, name: impl Into<Cow<'a, str>>) -> Self
pub fn new<'a>(value: V, node: &Node, name: impl Into<Cow<'a, str>>) -> 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 DerefMuts to the wrapped value. The watcher
will receive the updated value when the guard is Dropped.
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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more