Skip to main content

Layout

Trait Layout 

Source
pub trait Layout<C: Context>: 'static {
    type Item: Default + 'static;

    // Required methods
    fn fit(
        &self,
        cx: &mut LayoutCx<'_, C, Self::Item>,
        axis: Axis,
    ) -> Fit<C::Scalar>;
    fn distribute(
        &self,
        cx: &mut LayoutCx<'_, C, Self::Item>,
        axis: Axis,
        extent: C::Scalar,
    );
}

Required Associated Types§

Source

type Item: Default + 'static

per child data interpreted by this layout children without explicit items share this type’s default value

Required Methods§

Source

fn fit( &self, cx: &mut LayoutCx<'_, C, Self::Item>, axis: Axis, ) -> Fit<C::Scalar>

smallest and natural content extents along an axis

Source

fn distribute( &self, cx: &mut LayoutCx<'_, C, Self::Item>, axis: Axis, extent: C::Scalar, )

splits this node’s final content extent and positions children along an axis

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<C: Context> Layout<C> for ()

overlaps children at the content origin

Source§

type Item = ()

Source§

fn fit(&self, cx: &mut LayoutCx<'_, C, ()>, axis: Axis) -> Fit<C::Scalar>

Source§

fn distribute( &self, cx: &mut LayoutCx<'_, C, ()>, _axis: Axis, extent: C::Scalar, )

Implementors§