[−][src]Struct kas::layout::SolveCache
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
impl SolveCache
[src]
pub fn min(&self, inner_margin: bool) -> Size
[src]
Get the minimum size
If inner_margin
is true, margins are included in the result.
pub fn ideal(&self, inner_margin: bool) -> Size
[src]
Get the ideal size
If inner_margin
is true, margins are included in the result.
pub fn margins(&self) -> Margins
[src]
Get the margins
pub fn find_constraints(
widget: &mut dyn WidgetConfig,
size_handle: &mut dyn SizeHandle
) -> Self
[src]
widget: &mut dyn WidgetConfig,
size_handle: &mut dyn SizeHandle
) -> Self
Calculate required size of widget
pub fn invalidate_rule_cache(&mut self)
[src]
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,
size_handle: &mut dyn SizeHandle,
rect: Rect,
inner_margin: bool
)
[src]
&mut self,
widget: &mut dyn WidgetConfig,
size_handle: &mut dyn SizeHandle,
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,