pub struct LayoutEngine { /* private fields */ }Expand description
Configurable layout engine.
Implementations§
Source§impl LayoutEngine
impl LayoutEngine
Sourcepub fn new(mode: LayoutMode) -> Self
pub fn new(mode: LayoutMode) -> Self
Create a new layout engine with the specified mode.
Sourcepub fn set_mode(&mut self, mode: LayoutMode)
pub fn set_mode(&mut self, mode: LayoutMode)
Set the layout mode.
Sourcepub fn mode(&self) -> &LayoutMode
pub fn mode(&self) -> &LayoutMode
Get the current layout mode.
Sourcepub fn compute_layout(
&mut self,
tree: &UiTree,
viewport_size: Size<f32>,
widget_registry: &WidgetTypeRegistry,
)
pub fn compute_layout( &mut self, tree: &UiTree, viewport_size: Size<f32>, widget_registry: &WidgetTypeRegistry, )
Compute layout for the tree.
In synchronous mode, this blocks until layout is complete. In async mode, this queues a layout request and returns immediately.
Sourcepub fn poll_results(&mut self) -> usize
pub fn poll_results(&mut self) -> usize
Poll for async layout results.
Returns the number of results processed.
Sourcepub fn get_layout(&self, node_id: NodeId) -> Option<LayoutRect>
pub fn get_layout(&self, node_id: NodeId) -> Option<LayoutRect>
Get layout for a node.
In async mode, this may return a slightly stale layout.
Sourcepub fn is_layout_current(&self) -> bool
pub fn is_layout_current(&self) -> bool
Check if layout is current (not stale).
Sourcepub fn is_layout_in_progress(&self) -> bool
pub fn is_layout_in_progress(&self) -> bool
Check if async layout is in progress.
Sourcepub fn frames_stale(&self) -> u64
pub fn frames_stale(&self) -> u64
Get the number of frames layout is stale by.
Trait Implementations§
Source§impl Default for LayoutEngine
impl Default for LayoutEngine
Auto Trait Implementations§
impl Freeze for LayoutEngine
impl !RefUnwindSafe for LayoutEngine
impl Send for LayoutEngine
impl !Sync for LayoutEngine
impl Unpin for LayoutEngine
impl UnsafeUnpin for LayoutEngine
impl !UnwindSafe for LayoutEngine
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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