pub trait Inspector: Sized {
type ChildInspector<'a>: Inspector;
Show 21 methods
// Required methods
fn record_child<F: FnOnce(&mut Self::ChildInspector<'_>)>(
&mut self,
name: &str,
f: F,
);
fn record_unnamed_child<F: FnOnce(&mut Self::ChildInspector<'_>)>(
&mut self,
f: F,
);
fn record_usize<T: Into<usize>>(&mut self, name: &str, value: T);
fn record_uint<T: Into<u64>>(&mut self, name: &str, value: T);
fn record_int<T: Into<i64>>(&mut self, name: &str, value: T);
fn record_double<T: Into<f64>>(&mut self, name: &str, value: T);
fn record_str(&mut self, name: &str, value: &str);
fn record_string(&mut self, name: &str, value: String);
fn record_bool(&mut self, name: &str, value: bool);
// Provided methods
fn record_display_child<T: Display, F: FnOnce(&mut Self::ChildInspector<'_>)>(
&mut self,
name: T,
f: F,
) { ... }
fn record_debug_child<T: Debug, F: FnOnce(&mut Self::ChildInspector<'_>)>(
&mut self,
name: T,
f: F,
) { ... }
fn record_counter(&mut self, name: &str, value: &Counter) { ... }
fn record_display<T: Display>(&mut self, name: &str, value: T) { ... }
fn record_debug<T: Debug>(&mut self, name: &str, value: T) { ... }
fn record_ip_addr<A: IpAddress>(&mut self, name: &str, value: A) { ... }
fn record_zoned_addr_with_port<I: InspectorDeviceExt<D>, A: IpAddress, D, P: Display>(
&mut self,
name: &str,
addr: ZonedAddr<A, D>,
port: P,
) { ... }
fn record_local_socket_addr<I: InspectorDeviceExt<D>, A: IpAddress, D, P: Display>(
&mut self,
addr_with_port: Option<(ZonedAddr<A, D>, P)>,
) { ... }
fn record_remote_socket_addr<I: InspectorDeviceExt<D>, A: IpAddress, D, P: Display>(
&mut self,
addr_with_port: Option<(ZonedAddr<A, D>, P)>,
) { ... }
fn record_inspectable_value<V: InspectableValue>(
&mut self,
name: &str,
value: &V,
) { ... }
fn record_inspectable<V: Inspectable>(&mut self, name: &str, value: &V) { ... }
fn delegate_inspectable<V: Inspectable>(&mut self, value: &V) { ... }
}
Expand description
A trait abstracting a state inspector.
This trait follows roughly the same shape as the API provided by the fuchsia_inspect crate, but we abstract it out so not to take the dependency.
Given we have the trait, we can fill it in with some helpful default implementations for common types that are exposed as well, like IP addresses and such.
Required Associated Types§
Sourcetype ChildInspector<'a>: Inspector
type ChildInspector<'a>: Inspector
The type given to record contained children.
Required Methods§
Sourcefn record_child<F: FnOnce(&mut Self::ChildInspector<'_>)>(
&mut self,
name: &str,
f: F,
)
fn record_child<F: FnOnce(&mut Self::ChildInspector<'_>)>( &mut self, name: &str, f: F, )
Records a nested inspector with name
calling f
with the nested child
to be filled in.
This is used to group and contextualize data.
Sourcefn record_unnamed_child<F: FnOnce(&mut Self::ChildInspector<'_>)>(
&mut self,
f: F,
)
fn record_unnamed_child<F: FnOnce(&mut Self::ChildInspector<'_>)>( &mut self, f: F, )
Records a child without a name.
The Inpector
is expected to keep track of the number of unnamed
children and allocate names appropriately from that.
Sourcefn record_usize<T: Into<usize>>(&mut self, name: &str, value: T)
fn record_usize<T: Into<usize>>(&mut self, name: &str, value: T)
Records anything that can be represented by a usize.
Sourcefn record_uint<T: Into<u64>>(&mut self, name: &str, value: T)
fn record_uint<T: Into<u64>>(&mut self, name: &str, value: T)
Records anything that can be represented by a u64.
Sourcefn record_int<T: Into<i64>>(&mut self, name: &str, value: T)
fn record_int<T: Into<i64>>(&mut self, name: &str, value: T)
Records anything that can be represented by a i64.
Sourcefn record_double<T: Into<f64>>(&mut self, name: &str, value: T)
fn record_double<T: Into<f64>>(&mut self, name: &str, value: T)
Records anything that can be represented by a f64.
Sourcefn record_str(&mut self, name: &str, value: &str)
fn record_str(&mut self, name: &str, value: &str)
Records a str value.
Sourcefn record_string(&mut self, name: &str, value: String)
fn record_string(&mut self, name: &str, value: String)
Records an owned string.
Sourcefn record_bool(&mut self, name: &str, value: bool)
fn record_bool(&mut self, name: &str, value: bool)
Records a boolean.
Provided Methods§
Sourcefn record_display_child<T: Display, F: FnOnce(&mut Self::ChildInspector<'_>)>(
&mut self,
name: T,
f: F,
)
fn record_display_child<T: Display, F: FnOnce(&mut Self::ChildInspector<'_>)>( &mut self, name: T, f: F, )
Records a child whose name is the display implementation of T
.
Sourcefn record_debug_child<T: Debug, F: FnOnce(&mut Self::ChildInspector<'_>)>(
&mut self,
name: T,
f: F,
)
fn record_debug_child<T: Debug, F: FnOnce(&mut Self::ChildInspector<'_>)>( &mut self, name: T, f: F, )
Records a child whose name is the Debug implementation of T
.
Sourcefn record_counter(&mut self, name: &str, value: &Counter)
fn record_counter(&mut self, name: &str, value: &Counter)
Records a counter.
Sourcefn record_display<T: Display>(&mut self, name: &str, value: T)
fn record_display<T: Display>(&mut self, name: &str, value: T)
Records a value
that implements Display
as its display string.
Sourcefn record_debug<T: Debug>(&mut self, name: &str, value: T)
fn record_debug<T: Debug>(&mut self, name: &str, value: T)
Records a value
that implements Debug
as its debug string.
Sourcefn record_ip_addr<A: IpAddress>(&mut self, name: &str, value: A)
fn record_ip_addr<A: IpAddress>(&mut self, name: &str, value: A)
Records an IP address.
Sourcefn record_zoned_addr_with_port<I: InspectorDeviceExt<D>, A: IpAddress, D, P: Display>(
&mut self,
name: &str,
addr: ZonedAddr<A, D>,
port: P,
)
fn record_zoned_addr_with_port<I: InspectorDeviceExt<D>, A: IpAddress, D, P: Display>( &mut self, name: &str, addr: ZonedAddr<A, D>, port: P, )
Records a ZonedAddr
and it’s port, mapping the zone into an
inspectable device identifier.
Sourcefn record_local_socket_addr<I: InspectorDeviceExt<D>, A: IpAddress, D, P: Display>(
&mut self,
addr_with_port: Option<(ZonedAddr<A, D>, P)>,
)
fn record_local_socket_addr<I: InspectorDeviceExt<D>, A: IpAddress, D, P: Display>( &mut self, addr_with_port: Option<(ZonedAddr<A, D>, P)>, )
Records the local address of a socket.
Sourcefn record_remote_socket_addr<I: InspectorDeviceExt<D>, A: IpAddress, D, P: Display>(
&mut self,
addr_with_port: Option<(ZonedAddr<A, D>, P)>,
)
fn record_remote_socket_addr<I: InspectorDeviceExt<D>, A: IpAddress, D, P: Display>( &mut self, addr_with_port: Option<(ZonedAddr<A, D>, P)>, )
Records the remote address of a socket.
Sourcefn record_inspectable_value<V: InspectableValue>(
&mut self,
name: &str,
value: &V,
)
fn record_inspectable_value<V: InspectableValue>( &mut self, name: &str, value: &V, )
Records an implementor of InspectableValue
.
Sourcefn record_inspectable<V: Inspectable>(&mut self, name: &str, value: &V)
fn record_inspectable<V: Inspectable>(&mut self, name: &str, value: &V)
Records an implementor of Inspectable
under name
.
Sourcefn delegate_inspectable<V: Inspectable>(&mut self, value: &V)
fn delegate_inspectable<V: Inspectable>(&mut self, value: &V)
Delegates more fields to be added by an Inspectable
implementation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.