pub struct MeasureInput<'a> {
pub current_node_id: NodeId,
pub tree: &'a ComponentNodeTree,
pub parent_constraint: &'a Constraint,
pub children_ids: &'a [NodeId],
pub metadatas: &'a ComponentNodeMetaDatas,
pub compute_resource_manager: Arc<RwLock<ComputeResourceManager>>,
pub gpu: &'a Device,
}
Expand description
Input for the measure function (MeasureFn
).
Fields§
§current_node_id: NodeId
The NodeId
of the current node being measured.
tree: &'a ComponentNodeTree
The component tree containing all nodes.
parent_constraint: &'a Constraint
The effective constraint for this node, merged with its parent’s constraint.
children_ids: &'a [NodeId]
The children nodes of the current node.
metadatas: &'a ComponentNodeMetaDatas
Metadata for all component nodes, used to access cached data and constraints.
compute_resource_manager: Arc<RwLock<ComputeResourceManager>>
Compute resources manager
gpu: &'a Device
Gpu device
Implementations§
Source§impl<'a> MeasureInput<'a>
impl<'a> MeasureInput<'a>
Sourcepub fn metadata_mut(&self) -> RefMut<'_, NodeId, ComponentNodeMetaData>
pub fn metadata_mut(&self) -> RefMut<'_, NodeId, ComponentNodeMetaData>
Returns a mutable reference to the metadata of the current node.
This is a convenience method that simplifies accessing the current node’s metadata
from within a measure
function. It encapsulates the DashMap::get_mut
call and panics
if the metadata is not found, as it’s an invariant that it must exist.
Sourcepub fn measure_children(
&self,
nodes_to_measure: Vec<(NodeId, Constraint)>,
) -> Result<HashMap<NodeId, ComputedData>, MeasurementError>
pub fn measure_children( &self, nodes_to_measure: Vec<(NodeId, Constraint)>, ) -> Result<HashMap<NodeId, ComputedData>, MeasurementError>
Measures all specified child nodes under the given constraint.
Returns a map of each child’s computed layout data, or the first measurement error encountered.
Sourcepub fn measure_child(
&self,
child_id: NodeId,
constraint: &Constraint,
) -> Result<ComputedData, MeasurementError>
pub fn measure_child( &self, child_id: NodeId, constraint: &Constraint, ) -> Result<ComputedData, MeasurementError>
Measures a single child node under the given constraint.
Returns the computed layout data or a measurement error.
Sourcepub fn place_child(&self, child_id: NodeId, position: PxPosition)
pub fn place_child(&self, child_id: NodeId, position: PxPosition)
Sets the relative position of a child node.
Sourcepub fn enable_clipping(&self)
pub fn enable_clipping(&self)
Enables clipping for the current node.
Sourcepub fn disable_clipping(&self)
pub fn disable_clipping(&self)
Disables clipping for the current node.
Auto Trait Implementations§
impl<'a> Freeze for MeasureInput<'a>
impl<'a> !RefUnwindSafe for MeasureInput<'a>
impl<'a> Send for MeasureInput<'a>
impl<'a> Sync for MeasureInput<'a>
impl<'a> Unpin for MeasureInput<'a>
impl<'a> !UnwindSafe for MeasureInput<'a>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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