pub struct Node { /* private fields */ }
Expand description
Inspect Node data type.
NOTE: do not rely on PartialEq implementation for true comparison. Instead leverage the reader.
NOTE: Operations on a Default value are no-ops.
Implementations§
Source§impl Node
impl Node
Sourcepub fn clone_weak(&self) -> Node
pub fn clone_weak(&self) -> Node
Create a weak reference to the original node. All operations on a weak reference have identical semantics to the original node for as long as the original node is live. After that, all operations are no-ops.
Sourcepub fn create_child(&self, name: impl Into<StringReference>) -> Node
pub fn create_child(&self, name: impl Into<StringReference>) -> Node
Add a child to this node.
Sourcepub fn record_child<F>(&self, name: impl Into<StringReference>, initialize: F)
pub fn record_child<F>(&self, name: impl Into<StringReference>, initialize: F)
Creates and keeps track of a child with the given name
.
Sourcepub fn atomic_update<F, R>(&self, update_fn: F) -> R
pub fn atomic_update<F, R>(&self, update_fn: F) -> R
Takes a function to execute as under a single lock of the Inspect VMO. This function
receives a reference to the Node
where this is called.
Sourcepub fn record(&self, property: impl InspectType + 'static)
pub fn record(&self, property: impl InspectType + 'static)
Keeps track of the given property for the lifetime of the node.
Sourcepub fn clear_recorded(&self)
pub fn clear_recorded(&self)
Drop all recorded data from the node.
Sourcepub fn create_int(
&self,
name: impl Into<StringReference>,
value: i64,
) -> IntProperty
pub fn create_int( &self, name: impl Into<StringReference>, value: i64, ) -> IntProperty
Creates a new IntProperty
with the given name
and value
.
Sourcepub fn record_int(&self, name: impl Into<StringReference>, value: i64)
pub fn record_int(&self, name: impl Into<StringReference>, value: i64)
Records a new IntProperty
with the given name
and value
.
Sourcepub fn create_uint(
&self,
name: impl Into<StringReference>,
value: u64,
) -> UintProperty
pub fn create_uint( &self, name: impl Into<StringReference>, value: u64, ) -> UintProperty
Creates a new UintProperty
with the given name
and value
.
Sourcepub fn record_uint(&self, name: impl Into<StringReference>, value: u64)
pub fn record_uint(&self, name: impl Into<StringReference>, value: u64)
Records a new UintProperty
with the given name
and value
.
Sourcepub fn create_double(
&self,
name: impl Into<StringReference>,
value: f64,
) -> DoubleProperty
pub fn create_double( &self, name: impl Into<StringReference>, value: f64, ) -> DoubleProperty
Creates a new DoubleProperty
with the given name
and value
.
Sourcepub fn record_double(&self, name: impl Into<StringReference>, value: f64)
pub fn record_double(&self, name: impl Into<StringReference>, value: f64)
Records a new DoubleProperty
with the given name
and value
.
Sourcepub fn create_string_array(
&self,
name: impl Into<StringReference>,
slots: usize,
) -> StringArrayProperty
pub fn create_string_array( &self, name: impl Into<StringReference>, slots: usize, ) -> StringArrayProperty
Creates a new StringArrayProperty
with the given name
and slots
.
Sourcepub fn create_int_array(
&self,
name: impl Into<StringReference>,
slots: usize,
) -> IntArrayProperty
pub fn create_int_array( &self, name: impl Into<StringReference>, slots: usize, ) -> IntArrayProperty
Creates a new IntArrayProperty
with the given name
and slots
.
Sourcepub fn create_uint_array(
&self,
name: impl Into<StringReference>,
slots: usize,
) -> UintArrayProperty
pub fn create_uint_array( &self, name: impl Into<StringReference>, slots: usize, ) -> UintArrayProperty
Creates a new UintArrayProperty
with the given name
and slots
.
Sourcepub fn create_double_array(
&self,
name: impl Into<StringReference>,
slots: usize,
) -> DoubleArrayProperty
pub fn create_double_array( &self, name: impl Into<StringReference>, slots: usize, ) -> DoubleArrayProperty
Creates a new DoubleArrayProperty
with the given name
and slots
.
Sourcepub fn create_int_linear_histogram(
&self,
name: impl Into<StringReference>,
params: LinearHistogramParams<i64>,
) -> IntLinearHistogramProperty
pub fn create_int_linear_histogram( &self, name: impl Into<StringReference>, params: LinearHistogramParams<i64>, ) -> IntLinearHistogramProperty
Creates a new IntLinearHistogramProperty
with the given name
and params
.
Sourcepub fn create_uint_linear_histogram(
&self,
name: impl Into<StringReference>,
params: LinearHistogramParams<u64>,
) -> UintLinearHistogramProperty
pub fn create_uint_linear_histogram( &self, name: impl Into<StringReference>, params: LinearHistogramParams<u64>, ) -> UintLinearHistogramProperty
Creates a new UintLinearHistogramProperty
with the given name
and params
.
Sourcepub fn create_double_linear_histogram(
&self,
name: impl Into<StringReference>,
params: LinearHistogramParams<f64>,
) -> DoubleLinearHistogramProperty
pub fn create_double_linear_histogram( &self, name: impl Into<StringReference>, params: LinearHistogramParams<f64>, ) -> DoubleLinearHistogramProperty
Creates a new DoubleLinearHistogramProperty
with the given name
and params
.
Sourcepub fn create_int_exponential_histogram(
&self,
name: impl Into<StringReference>,
params: ExponentialHistogramParams<i64>,
) -> IntExponentialHistogramProperty
pub fn create_int_exponential_histogram( &self, name: impl Into<StringReference>, params: ExponentialHistogramParams<i64>, ) -> IntExponentialHistogramProperty
Creates a new IntExponentialHistogramProperty
with the given name
and params
.
Sourcepub fn create_uint_exponential_histogram(
&self,
name: impl Into<StringReference>,
params: ExponentialHistogramParams<u64>,
) -> UintExponentialHistogramProperty
pub fn create_uint_exponential_histogram( &self, name: impl Into<StringReference>, params: ExponentialHistogramParams<u64>, ) -> UintExponentialHistogramProperty
Creates a new UintExponentialHistogramProperty
with the given name
and params
.
Sourcepub fn create_double_exponential_histogram(
&self,
name: impl Into<StringReference>,
params: ExponentialHistogramParams<f64>,
) -> DoubleExponentialHistogramProperty
pub fn create_double_exponential_histogram( &self, name: impl Into<StringReference>, params: ExponentialHistogramParams<f64>, ) -> DoubleExponentialHistogramProperty
Creates a new DoubleExponentialHistogramProperty
with the given name
and params
.
Sourcepub fn create_lazy_child<F>(
&self,
name: impl Into<StringReference>,
callback: F,
) -> LazyNode
pub fn create_lazy_child<F>( &self, name: impl Into<StringReference>, callback: F, ) -> LazyNode
Creates a new lazy child with the given name
and callback
.
callback
will be invoked each time the component’s Inspect is read.
callback
is expected to create a new Inspector and return it;
its contents will be rooted at the intended location (the self
node).
Sourcepub fn record_lazy_child<F>(
&self,
name: impl Into<StringReference>,
callback: F,
)
pub fn record_lazy_child<F>( &self, name: impl Into<StringReference>, callback: F, )
Records a new lazy child with the given name
and callback
.
callback
will be invoked each time the component’s Inspect is read.
callback
is expected to create a new Inspector and return it;
its contents will be rooted at the intended location (the self
node).
Sourcepub fn create_lazy_values<F>(
&self,
name: impl Into<StringReference>,
callback: F,
) -> LazyNode
pub fn create_lazy_values<F>( &self, name: impl Into<StringReference>, callback: F, ) -> LazyNode
Creates a new inline lazy node with the given name
and callback
.
callback
will be invoked each time the component’s Inspect is read.
callback
is expected to create a new Inspector and return it;
its contents will be rooted at the intended location (the self
node).
Sourcepub fn record_lazy_values<F>(
&self,
name: impl Into<StringReference>,
callback: F,
)
pub fn record_lazy_values<F>( &self, name: impl Into<StringReference>, callback: F, )
Records a new inline lazy node with the given name
and callback
.
callback
will be invoked each time the component’s Inspect is read.
callback
is expected to create a new Inspector and return it;
its contents will be rooted at the intended location (the self
node).
Sourcepub fn create_string(
&self,
name: impl Into<StringReference>,
value: impl AsRef<str>,
) -> StringProperty
pub fn create_string( &self, name: impl Into<StringReference>, value: impl AsRef<str>, ) -> StringProperty
Add a string property to this node.
Sourcepub fn record_string(
&self,
name: impl Into<StringReference>,
value: impl AsRef<str>,
)
pub fn record_string( &self, name: impl Into<StringReference>, value: impl AsRef<str>, )
Creates and saves a string property for the lifetime of the node.
Sourcepub fn create_bytes(
&self,
name: impl Into<StringReference>,
value: impl AsRef<[u8]>,
) -> BytesProperty
pub fn create_bytes( &self, name: impl Into<StringReference>, value: impl AsRef<[u8]>, ) -> BytesProperty
Add a byte vector property to this node.
Sourcepub fn record_bytes(
&self,
name: impl Into<StringReference>,
value: impl AsRef<[u8]>,
)
pub fn record_bytes( &self, name: impl Into<StringReference>, value: impl AsRef<[u8]>, )
Creates and saves a bytes property for the lifetime of the node.
Sourcepub fn create_bool(
&self,
name: impl Into<StringReference>,
value: bool,
) -> BoolProperty
pub fn create_bool( &self, name: impl Into<StringReference>, value: bool, ) -> BoolProperty
Add a bool property to this node.
Sourcepub fn record_bool(&self, name: impl Into<StringReference>, value: bool)
pub fn record_bool(&self, name: impl Into<StringReference>, value: bool)
Creates and saves a bool property for the lifetime of the node.
Sourcepub fn adopt<T: InspectTypeReparentable>(&self, child: &T) -> Result<(), Error>
pub fn adopt<T: InspectTypeReparentable>(&self, child: &T) -> Result<(), Error>
Takes a child from its parent and adopts it into its own tree.
Sourcepub fn forget(&self)
pub fn forget(&self)
Removes this node from the Inspect tree. Typically, just dropping the Node must be preferred. However, this is a convenience method meant for power user implementations that need more control over the lifetime of a Node. For example, by being able to remove the node from a weak clone of it.
Trait Implementations§
impl Eq for Node
impl InspectType for Node
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl !RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl !UnwindSafe for Node
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more