Expand description
Provides utilities on top of regular inspect properties to enable convenient features such as:
-
Directly mutating a value and dumping it to inspect
use fuchsia_inspect::component; use fuchsia_inspect::contrib::inspectable::InspectableU64; let inspectable = InspectableU64::new(0, component::inspector::root(), "foo"); *inspectable.get_mut() += 1; // The value of the u64 is 1 now and it was updated automatically in the inspect vmo.
-
Dump lengths automatically
use fuchsia_inspect::component; use fuchsia_inspect::contrib::inspectable::InspectableLen; let inspectable = InspectableLen::new(vec![0], component::inspector::root(), "foo"); // The value of the vector is [0] and the value in the inspect vmo under the foo property // is 1. *inspectable.get_mut().push(3); // The value of the vector is [0, 3] and the value in the inspect vmo under the foo property // is 2.
-
Dump debug representations automatically, etc.
use fuchsia_inspect::component; use fuchsia_inspect::contrib::inspectable::InspectableDebugString; let inspectable = InspectableDebugString::new(vec![0], component::inspector::root(), "foo"); // The value of the vector is vec![0] and the value in the inspect vmo under the foo property // is the debug string of the vector "[0]". *inspectable.get_mut().push(3); // The value of the vector is vec![0, 3] and the value in the inspect vmo under the foo // property is the debug string of the vector "[0, 3]".
Structs§
- Inspectable
- Generic wrapper for exporting variables via Inspect. Mutations to
the wrapped
value
occur through anInspectableGuard
, which notifies thewatcher
whenDrop
ped, transparently keeping the Inspect state up-to-date. - Inspectable
Bool Watcher - Inspectable
Debug String Watcher - Exports via an Inspect
StringProperty
theDebug
representation of the wrappedvalue
. - Inspectable
Guard - Calls self.watcher.watch(self.value) when dropped.
- Inspectable
LenWatcher - Exports via an Inspect
UintProperty
thelen
of the wrapped container. - Inspectable
U64Watcher - Exports via an Inspect
UintProperty
au64
. Useful because the wrappedu64
value can be read.
Traits§
- Len
- Trait implemented by types that can provide a length. Values used for
InspectableLen
must implement this. - Watch
- Used for exporting an
[Inspectable
]Inspectable’s wrapped value .
Type Aliases§
- Inspectable
Bool - Inspectable
Debug String - Exports via an Inspect
StringProperty
theDebug
representation of the wrapped valueV
. - Inspectable
Len - Exports via an Inspect
UintProperty
thelen
of the wrapped valueV
. - Inspectable
U64 - Exports via an Inspect
UintProperty
au64
. Useful because the wrappedu64
value can be read.