Struct kas::layout::SolveCache [−][src]
pub struct SolveCache { /* fields omitted */ }
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
Get the minimum size
If inner_margin
is true, margins are included in the result.
Get the ideal size
If inner_margin
is true, margins are included in the result.
pub fn find_constraints(
widget: &mut (dyn WidgetConfig + 'static),
size_handle: &mut dyn SizeHandle
) -> SolveCache
pub fn find_constraints(
widget: &mut (dyn WidgetConfig + 'static),
size_handle: &mut dyn SizeHandle
) -> SolveCache
Calculate required size of widget
Force updating of size rules
This should be called whenever widget size rules have been changed. It
forces SolveCache::apply_rect
to recompute these rules when next
called.
pub fn apply_rect(
&mut self,
widget: &mut (dyn WidgetConfig + 'static),
mgr: &mut Manager<'_>,
rect: Rect,
inner_margin: bool
)
pub fn apply_rect(
&mut self,
widget: &mut (dyn WidgetConfig + 'static),
mgr: &mut Manager<'_>,
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.
If SolveCache::invalidate_rule_cache
was called since rules were
last calculated then this method will recalculate all rules; otherwise
it will only do so if necessary (when dimensions do not match those
last used).
Auto Trait Implementations
impl RefUnwindSafe for SolveCache
impl Send for SolveCache
impl Sync for SolveCache
impl Unpin for SolveCache
impl UnwindSafe for SolveCache
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more