Skip to main content

LayoutMeasurer

Trait LayoutMeasurer 

Source
pub trait LayoutMeasurer<Key: NodeKey> {
    // Required methods
    fn measure(
        &mut self,
        node_id: Key,
        node: &Node,
        size: &Size2D,
    ) -> Option<(Size2D, Rc<dyn Any>)>;
    fn should_hook_measurement(&mut self, node_id: Key) -> bool;
    fn should_measure_inner_children(&mut self, node_id: Key) -> bool;

    // Provided methods
    fn should_post_measure(&mut self, _node_id: Key) -> bool { ... }
    fn post_measure(
        &mut self,
        _node_id: Key,
        _node_layout: &LayoutNode,
        _children: &[Key],
        _layout: &Torin<Key>,
    ) -> PostMeasure<Key> { ... }
    fn notify_layout_references(
        &mut self,
        _node_id: Key,
        _area: Area,
        _visible_area: Area,
        _inner_sizes: Size2D,
    ) { ... }
}

Required Methods§

Source

fn measure( &mut self, node_id: Key, node: &Node, size: &Size2D, ) -> Option<(Size2D, Rc<dyn Any>)>

Source

fn should_hook_measurement(&mut self, node_id: Key) -> bool

Source

fn should_measure_inner_children(&mut self, node_id: Key) -> bool

Provided Methods§

Source

fn should_post_measure(&mut self, _node_id: Key) -> bool

Whether LayoutMeasurer::post_measure should run for this node.

Source

fn post_measure( &mut self, _node_id: Key, _node_layout: &LayoutNode, _children: &[Key], _layout: &Torin<Key>, ) -> PostMeasure<Key>

Runs after a node and its children are measured.

Source

fn notify_layout_references( &mut self, _node_id: Key, _area: Area, _visible_area: Area, _inner_sizes: Size2D, )

Implementors§