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 readable_column(&self) -> Option<Length> { ... }
    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 readable_column(&self) -> Option<Length>

The readable column this arrangement keeps what it holds in, when it is one: a page’s measure, which a bar at the foot of the column stands in too.

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§