Skip to main content

Element

Trait Element 

Source
pub trait Element {
    // Required methods
    fn measure(&self, ctx: MeasureCtx<'_>) -> ElementSize;
    fn draw(&self, ctx: DrawCtx<'_, '_>) -> ElementSize;

    // Provided methods
    fn first_location_usage(
        &self,
        ctx: FirstLocationUsageCtx<'_>,
    ) -> FirstLocationUsage { ... }
    fn with_padding_top(self, padding: f32) -> Padding<Self>
       where Self: Sized { ... }
    fn with_padding_bottom(self, padding: f32) -> Padding<Self>
       where Self: Sized { ... }
    fn with_vertical_padding(self, padding: f32) -> Padding<Self>
       where Self: Sized { ... }
    fn with_padding_left(self, padding: f32) -> Padding<Self>
       where Self: Sized { ... }
    fn with_padding_right(self, padding: f32) -> Padding<Self>
       where Self: Sized { ... }
    fn with_horizontal_padding(self, padding: f32) -> Padding<Self>
       where Self: Sized { ... }
    fn debug(self, color: u8) -> Debug<Self>
       where Self: Sized { ... }
}
Expand description

Rules: Width returned from measure has to be matched in draw given the same constraint (even if there’s some preferred height).

Required Methods§

Source

fn measure(&self, ctx: MeasureCtx<'_>) -> ElementSize

Source

fn draw(&self, ctx: DrawCtx<'_, '_>) -> ElementSize

Provided Methods§

Source

fn first_location_usage( &self, ctx: FirstLocationUsageCtx<'_>, ) -> FirstLocationUsage

Source

fn with_padding_top(self, padding: f32) -> Padding<Self>
where Self: Sized,

Source

fn with_padding_bottom(self, padding: f32) -> Padding<Self>
where Self: Sized,

Source

fn with_vertical_padding(self, padding: f32) -> Padding<Self>
where Self: Sized,

Source

fn with_padding_left(self, padding: f32) -> Padding<Self>
where Self: Sized,

Source

fn with_padding_right(self, padding: f32) -> Padding<Self>
where Self: Sized,

Source

fn with_horizontal_padding(self, padding: f32) -> Padding<Self>
where Self: Sized,

Source

fn debug(self, color: u8) -> Debug<Self>
where Self: Sized,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Element for Circle

Source§

impl Element for Empty

Source§

impl Element for FakeImage

Source§

impl Element for FakeText

Source§

impl Element for ForceBreak

Source§

impl Element for FranticJumper

Source§

impl Element for Line

Source§

impl Element for NoneElement

Source§

impl Element for Rectangle

Source§

impl Element for VGap

Source§

impl<'a, E: Element> Element for BreakWhole<'a, E>

Source§

impl<'a, E: Element> Element for ElementProxy<'a, E>

Source§

impl<'a, E: Element> Element for Link<'a, E>

Source§

impl<'a, E: Element> Element for RefElement<'a, E>

Source§

impl<'a, F: Font + 'a, S: Iterator<Item = Span<'a, F>> + Clone> Element for RichText<S>

Source§

impl<'a, F: Font + 'a> Element for Text<'a, F>

Source§

impl<'a, T: Element, C: Element> Element for RepeatAfterBreak<'a, T, C>

Source§

impl<'a, T: Element, C: Element> Element for TitleOrBreak<'a, T, C>

Source§

impl<'a> Element for ImageElement<'a>

Source§

impl<'a> Element for Svg<'a>

Source§

impl<C: CompositeElement> Element for C

Source§

impl<C: Element, B: Element> Element for PinBelow<C, B>

Source§

impl<C: Element, B: Element> Element for RepeatBottom<C, B>

Source§

impl<C: Fn(&mut StackContent<'_, '_, '_>)> Element for Stack<C>

Source§

impl<C: Fn(BreakListContent<'_, '_, '_>) -> Option<()>> Element for BreakList<C>

Source§

impl<C: Fn(ColumnContent<'_, '_, '_>) -> Option<()>> Element for Column<C>

Source§

impl<E: Element> Element for AlignLocationBottom<E>

Source§

impl<E: Element> Element for AlignPreferredHeightBottom<E>

Source§

impl<E: Element> Element for AssertPasses<E>

Source§

impl<E: Element> Element for CenterInPreferredHeight<E>

Source§

impl<E: Element> Element for Debug<E>

Source§

impl<E: Element> Element for ExpandToPreferredHeight<E>

Source§

impl<E: Element> Element for HAlign<E>

Source§

impl<E: Element> Element for MaxWidth<E>

Source§

impl<E: Element> Element for MinFirstHeight<E>

Source§

impl<E: Element> Element for Padding<E>

Source§

impl<E: Element> Element for RecordPasses<E>

Source§

impl<E: Element> Element for Rotate<E>

Source§

impl<E: Element> Element for ShrinkToFit<E>

Source§

impl<E: Element> Element for StyledBox<E>

Source§

impl<F: Element, R: Element, C: Element> Element for ChangingTitle<F, R, C>

Source§

impl<F: Fn(&mut RowContent<'_, '_, '_>)> Element for Row<F>

Source§

impl<F: Fn(&mut RowContent<'_, '_, '_>)> Element for TableRow<F>

Source§

impl<F: Fn(BuildElementCtx, BuildElementCallback<'_>) -> BuildElementReturnToken> Element for BuildElement<F>

Source§

impl<P: Element, D: Fn(&mut DecorationElements<'_>, usize, usize)> Element for Page<P, D>

Source§

impl<T: Element, C: Element> Element for Titled<T, C>