pub struct ComponentTree { /* private fields */ }
Expand description
Respents a component tree
Implementations§
Source§impl ComponentTree
impl ComponentTree
Sourcepub fn get(&self, node_id: NodeId) -> Option<&ComponentNode>
pub fn get(&self, node_id: NodeId) -> Option<&ComponentNode>
Get node by NodeId
Sourcepub fn get_mut(&mut self, node_id: NodeId) -> Option<&mut ComponentNode>
pub fn get_mut(&mut self, node_id: NodeId) -> Option<&mut ComponentNode>
Get mutable node by NodeId
Sourcepub fn current_node(&self) -> Option<&ComponentNode>
pub fn current_node(&self) -> Option<&ComponentNode>
Get current node
Sourcepub fn current_node_mut(&mut self) -> Option<&mut ComponentNode>
pub fn current_node_mut(&mut self) -> Option<&mut ComponentNode>
Get mutable current node
Sourcepub fn add_node(&mut self, node_component: ComponentNode)
pub fn add_node(&mut self, node_component: ComponentNode)
Add a new node to the tree
Nodes now store their intrinsic constraints in their metadata.
The node_component
itself primarily holds the measure_fn.
Sourcepub fn compute(
&mut self,
screen_size: PxSize,
cursor_position: Option<PxPosition>,
cursor_events: Vec<CursorEvent>,
keyboard_events: Vec<KeyEvent>,
ime_events: Vec<Ime>,
modifiers: ModifiersState,
compute_resource_manager: Arc<RwLock<ComputeResourceManager>>,
gpu: &Device,
clipboard: &mut Clipboard,
) -> (Vec<(Command, PxSize, PxPosition)>, WindowRequests)
pub fn compute( &mut self, screen_size: PxSize, cursor_position: Option<PxPosition>, cursor_events: Vec<CursorEvent>, keyboard_events: Vec<KeyEvent>, ime_events: Vec<Ime>, modifiers: ModifiersState, compute_resource_manager: Arc<RwLock<ComputeResourceManager>>, gpu: &Device, clipboard: &mut Clipboard, ) -> (Vec<(Command, PxSize, PxPosition)>, WindowRequests)
Compute the ComponentTree into a list of rendering commands
This method processes the component tree through three main phases:
- Measure Phase: Calculate sizes and positions for all components
- Command Generation: Extract draw commands from component metadata
- State Handling: Process user interactions and events
Returns a tuple of (commands, window_requests) where commands contain the rendering instructions with their associated sizes and positions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ComponentTree
impl !RefUnwindSafe for ComponentTree
impl Send for ComponentTree
impl Sync for ComponentTree
impl Unpin for ComponentTree
impl !UnwindSafe for ComponentTree
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
Mutably borrows from an owned value. Read more
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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>
Converts
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>
Converts
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.