Rust libraries

This document explains what libraries are available for writing and reading Inspect data in Rust. For specific documentation of each library, refer to the crate documentation linked on each section.

Libraries for writing inspect

fuchsia-inspect

This is the core library. This library offers the core API for creating nodes, properties, serving Inspect, etc. Internally it implements the buddy allocation algorithm described in Inspect vmo format.

For an introduction to Inspect concepts and the rust libraries, see the codelab.

fuchsia-inspect-contrib

This library is intended for contributions to the Inspect library from clients. These are patterns that clients identify in their usage of Inspect that they can generalize and share. It’s intended to be at a higher level than fuchsia-inspect.

fuchsia-inspect-derive

This library provides a convenient way to manage Inspect data in a Rust program through a #[derive(Inspect)] procedural macro. This works at a higher level than fuchsia-inspect. For more information on this library, see Ergonomic Inspect.

Libraries for reading Inspect

These libraries are not specific to Inspect and are used for various kinds of diagnostics data.

diagnostics-hierarchy

This library includes the convenient macro assert_inspect_tree for testing as well as the definition of the DiagnosticsHierarchy, which is not exclusive to Inspect and is also used for logs and other diagnostics data sources.

diagnostics-testing

This library includes the convenient EnvForDiagnostics which is useful for testing Inspect integration in Components v1.

diagnostics-reader

This library includes the convenient ArchiveReader which is useful for fetching Inspect data from an archivist in a test or in production. It wraps the shared logic of connecting to the ArchiveAccessor and fetching data from it.