fuchsia_inspect_contrib

Module inspectable

Source
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§

  • 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.
  • Exports via an Inspect StringProperty the Debug representation of the wrapped value.
  • Calls self.watcher.watch(self.value) when dropped.
  • Exports via an Inspect UintProperty the len of the wrapped container.
  • Exports via an Inspect UintProperty a u64. Useful because the wrapped u64 value can be read.

Traits§

  • Trait implemented by types that can provide a length. Values used for InspectableLen must implement this.
  • Used for exporting an [Inspectable]Inspectable’s wrapped value .

Type Aliases§