[][src]Struct kas::layout::SolveCache

pub struct SolveCache { /* fields omitted */ }

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]

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]

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.