[go: up one dir, main page]

Layout

Trait Layout 

Source
pub trait Layout: Debug {
    // Required methods
    fn request_size(
        &self,
        ctx: &mut Context,
        children: Vec<SizeRequest>,
    ) -> SizeRequest;
    fn build(
        &self,
        ctx: &mut Context,
        size: (f32, f32),
        children: Vec<SizeRequest>,
    ) -> Vec<Area>;
}
Expand description

Trait for layouts that determine the offset and allotted sizes of its children

Required Methods§

Source

fn request_size( &self, ctx: &mut Context, children: Vec<SizeRequest>, ) -> SizeRequest

Given a list of children size requests calculate the size request for the total layout

Source

fn build( &self, ctx: &mut Context, size: (f32, f32), children: Vec<SizeRequest>, ) -> Vec<Area>

Given an allotted size and the list of chlidren size requests (which may respect the size request), calculate the actual offsets and allotted sizes for its children

Implementors§