Skip to main content

MeasuredComponent

Trait MeasuredComponent 

Source
pub trait MeasuredComponent<State, Msg>: Component<State, Msg> {
    // Required method
    fn measure(&self) -> Size;
}
Expand description

A Component that can report its preferred size before rendering.

Layout containers use this small core contract without depending on a specific component module.

Required Methods§

Source

fn measure(&self) -> Size

The component’s preferred width and height in terminal cells.

A container may still hand over a smaller area when space is constrained, so a component must keep coping with an undersized area.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S, M> MeasuredComponent<S, M> for Button<M>

Source§

impl<T: Clone + PartialEq, S, M> MeasuredComponent<S, M> for Tabs<T, S, M>