pub struct SolveCache { /* private fields */ }Expand description
Size solver
This struct is used to solve widget layout, read size constraints and cache the results until the next solver run.
SolveCache::find_constraints constructs an instance of this struct,
solving for size constraints.
SolveCache::apply_rect accepts a Rect, updates constraints as
necessary and sets widget positions within this rect.
Implementations§
Source§impl SolveCache
impl SolveCache
Sourcepub fn min(&self, inner_margin: bool) -> Size
pub fn min(&self, inner_margin: bool) -> Size
Get the minimum size
If inner_margin is true, margins are included in the result.
Sourcepub fn ideal(&self, inner_margin: bool) -> Size
pub fn ideal(&self, inner_margin: bool) -> Size
Get the ideal size
If inner_margin is true, margins are included in the result.
Sourcepub fn find_constraints(&mut self, widget: Node<'_>, cx: &mut SizeCx<'_>)
pub fn find_constraints(&mut self, widget: Node<'_>, cx: &mut SizeCx<'_>)
Calculate required size of widget
Assumes no explicit alignment.
Sourcepub fn apply_rect(
&mut self,
widget: Node<'_>,
cx: &mut SizeCx<'_>,
rect: Rect,
inner_margin: bool,
)
pub fn apply_rect( &mut self, widget: Node<'_>, cx: &mut SizeCx<'_>, rect: Rect, inner_margin: bool, )
Apply layout solution to a widget
The widget’s layout is solved for the given rect and assigned.
If inner_margin is true, margins are internal to this rect; if not,
the caller is responsible for handling margins.
This method will only recalculate rules as necessary (namely height rules when the width has changed).
Sourcepub fn print_widget_heirarchy(&mut self, widget: &dyn Tile)
pub fn print_widget_heirarchy(&mut self, widget: &dyn Tile)
Print widget heirarchy in the trace log
This is sometimes called after Self::apply_rect.
Trait Implementations§
Source§impl Default for SolveCache
impl Default for SolveCache
Source§fn default() -> SolveCache
fn default() -> SolveCache
Auto Trait Implementations§
impl Freeze for SolveCache
impl RefUnwindSafe for SolveCache
impl Send for SolveCache
impl Sync for SolveCache
impl Unpin for SolveCache
impl UnwindSafe for SolveCache
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
Source§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.