Trait Alignment

Source
pub trait Alignment:
    Copy
    + Clone
    + Default {
    // Required method
    fn align_with_offset(
        &self,
        what: Rectangle,
        reference: Rectangle,
        offset: i32,
    ) -> i32;

    // Provided method
    fn align(&self, what: Rectangle, reference: Rectangle) -> i32 { ... }
}
Expand description

Base trait for alignment operations

An Alignment object modifies either the horizontal, or the vertical position of a View. Usually, these objects are passed to methods of Align or they can be used to parametrize layouts.

Implementors should also implement either the HorizontalAlignment or VerticalAlignment trait, otherwise the implementor can’t be used as an alignment operation with embedded-layout.

Required Methods§

Source

fn align_with_offset( &self, what: Rectangle, reference: Rectangle, offset: i32, ) -> i32

Align one coordinate of View to the given reference with some offset

Provided Methods§

Source

fn align(&self, what: Rectangle, reference: Rectangle) -> i32

Align one coordinate of View to the given reference

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Alignment for embedded_layout::align::horizontal::Center

Source§

impl Alignment for Left

Source§

impl Alignment for LeftToRight

Source§

impl Alignment for embedded_layout::align::horizontal::NoAlignment

Source§

impl Alignment for Right

Source§

impl Alignment for RightToLeft

Source§

impl Alignment for Bottom

Source§

impl Alignment for BottomToTop

Source§

impl Alignment for embedded_layout::align::vertical::Center

Source§

impl Alignment for embedded_layout::align::vertical::NoAlignment

Source§

impl Alignment for Top

Source§

impl Alignment for TopToBottom