Skip to main content

Layout

Trait Layout 

pub trait Layout {
    // Required methods
    fn name(&self) -> &'static str;
    fn container(&self, resolved: &Resolved, lead: f32) -> Style;
    fn slot(&self, index: usize, slot: &Slot, resolved: &Resolved) -> Style;

    // Provided methods
    fn leading(&self) -> Side { ... }
    fn settle(&mut self, _allocated: Size<f32>, _resolved: &Resolved) -> bool { ... }
    fn items(&mut self, _count: usize) { ... }
    fn hidden(&self, _index: usize) -> bool { ... }
}
Expand description

How a primitive arranges its slots. See the module docs.

Required Methods§

fn name(&self) -> &'static str

fn container(&self, resolved: &Resolved, lead: f32) -> Style

The container’s style for the current arrangement, lead pixels of gutter reserved before what it holds.

fn slot(&self, index: usize, slot: &Slot, resolved: &Resolved) -> Style

The wrapper style of slot index for the current arrangement.

Provided Methods§

fn leading(&self) -> Side

The side the arrangement leads on: where lead reserves its gutter. A row written right to left leads on the right.

fn settle(&mut self, _allocated: Size<f32>, _resolved: &Resolved) -> bool

Decide the arrangement from the allocated size. Returns whether the styles must be computed again.

fn items(&mut self, _count: usize)

How many slots the container holds, told before each layout: a layout that arranges by count (a grid that keeps no empty columns) reads it.

fn hidden(&self, _index: usize) -> bool

Whether slot index is not shown in the current arrangement.

Implementors§