Trait netstack3_core::Inspector
source · pub trait Inspector: Sized {
type ChildInspector<'a>: Inspector;
Show 21 methods
// Required methods
fn record_child<F>(&mut self, name: &str, f: F)
where F: FnOnce(&mut Self::ChildInspector<'_>);
fn record_unnamed_child<F>(&mut self, f: F)
where F: FnOnce(&mut Self::ChildInspector<'_>);
fn record_usize<T>(&mut self, name: &str, value: T)
where T: Into<usize>;
fn record_uint<T>(&mut self, name: &str, value: T)
where T: Into<u64>;
fn record_int<T>(&mut self, name: &str, value: T)
where T: Into<i64>;
fn record_double<T>(&mut self, name: &str, value: T)
where T: Into<f64>;
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, F>(&mut self, name: T, f: F)
where T: Display,
F: FnOnce(&mut Self::ChildInspector<'_>) { ... }
fn record_debug_child<T, F>(&mut self, name: T, f: F)
where T: Debug,
F: FnOnce(&mut Self::ChildInspector<'_>) { ... }
fn record_counter(&mut self, name: &str, value: &Counter) { ... }
fn record_display<T>(&mut self, name: &str, value: T)
where T: Display { ... }
fn record_debug<T>(&mut self, name: &str, value: T)
where T: Debug { ... }
fn record_ip_addr<A>(&mut self, name: &str, value: A)
where A: IpAddress { ... }
fn record_zoned_addr_with_port<I, A, D, P>(
&mut self,
name: &str,
addr: ZonedAddr<A, D>,
port: P,
)
where I: InspectorDeviceExt<D>,
A: IpAddress,
P: Display { ... }
fn record_local_socket_addr<I, A, D, P>(
&mut self,
addr_with_port: Option<(ZonedAddr<A, D>, P)>,
)
where I: InspectorDeviceExt<D>,
A: IpAddress,
P: Display { ... }
fn record_remote_socket_addr<I, A, D, P>(
&mut self,
addr_with_port: Option<(ZonedAddr<A, D>, P)>,
)
where I: InspectorDeviceExt<D>,
A: IpAddress,
P: Display { ... }
fn record_inspectable_value<V>(&mut self, name: &str, value: &V)
where V: InspectableValue { ... }
fn record_inspectable<V>(&mut self, name: &str, value: &V)
where V: Inspectable { ... }
fn delegate_inspectable<V>(&mut self, value: &V)
where V: Inspectable { ... }
}
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>(&mut self, name: &str, f: F)where
F: FnOnce(&mut Self::ChildInspector<'_>),
fn record_child<F>(&mut self, name: &str, f: F)where
F: FnOnce(&mut Self::ChildInspector<'_>),
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>(&mut self, f: F)where
F: FnOnce(&mut Self::ChildInspector<'_>),
fn record_unnamed_child<F>(&mut self, f: F)where
F: FnOnce(&mut Self::ChildInspector<'_>),
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>(&mut self, name: &str, value: T)
fn record_usize<T>(&mut self, name: &str, value: T)
Records anything that can be represented by a usize.
sourcefn record_uint<T>(&mut self, name: &str, value: T)
fn record_uint<T>(&mut self, name: &str, value: T)
Records anything that can be represented by a u64.
sourcefn record_int<T>(&mut self, name: &str, value: T)
fn record_int<T>(&mut self, name: &str, value: T)
Records anything that can be represented by a i64.
sourcefn record_double<T>(&mut self, name: &str, value: T)
fn record_double<T>(&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, F>(&mut self, name: T, f: F)
fn record_display_child<T, F>(&mut self, name: T, f: F)
Records a child whose name is the display implementation of T
.
sourcefn record_debug_child<T, F>(&mut self, name: T, f: F)
fn record_debug_child<T, F>(&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>(&mut self, name: &str, value: T)where
T: Display,
fn record_display<T>(&mut self, name: &str, value: T)where
T: Display,
Records a value
that implements Display
as its display string.
sourcefn record_debug<T>(&mut self, name: &str, value: T)where
T: Debug,
fn record_debug<T>(&mut self, name: &str, value: T)where
T: Debug,
Records a value
that implements Debug
as its debug string.
sourcefn record_ip_addr<A>(&mut self, name: &str, value: A)where
A: IpAddress,
fn record_ip_addr<A>(&mut self, name: &str, value: A)where
A: IpAddress,
Records an IP address.
sourcefn record_zoned_addr_with_port<I, A, D, P>(
&mut self,
name: &str,
addr: ZonedAddr<A, D>,
port: P,
)
fn record_zoned_addr_with_port<I, A, D, P>( &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, A, D, P>(
&mut self,
addr_with_port: Option<(ZonedAddr<A, D>, P)>,
)
fn record_local_socket_addr<I, A, D, P>( &mut self, addr_with_port: Option<(ZonedAddr<A, D>, P)>, )
Records the local address of a socket.
sourcefn record_remote_socket_addr<I, A, D, P>(
&mut self,
addr_with_port: Option<(ZonedAddr<A, D>, P)>,
)
fn record_remote_socket_addr<I, A, D, P>( &mut self, addr_with_port: Option<(ZonedAddr<A, D>, P)>, )
Records the remote address of a socket.
sourcefn record_inspectable_value<V>(&mut self, name: &str, value: &V)where
V: InspectableValue,
fn record_inspectable_value<V>(&mut self, name: &str, value: &V)where
V: InspectableValue,
Records an implementor of InspectableValue
.
sourcefn record_inspectable<V>(&mut self, name: &str, value: &V)where
V: Inspectable,
fn record_inspectable<V>(&mut self, name: &str, value: &V)where
V: Inspectable,
Records an implementor of Inspectable
under name
.
sourcefn delegate_inspectable<V>(&mut self, value: &V)where
V: Inspectable,
fn delegate_inspectable<V>(&mut self, value: &V)where
V: Inspectable,
Delegates more fields to be added by an Inspectable
implementation.