Trait Orientation

Source
pub trait Orientation: Copy + Clone {
    type Secondary: SecondaryAlignment + Alignment;

    // Required methods
    fn destructure_size(size: Size) -> (u32, u32);
    fn create_size(primary: u32, secondary: u32) -> Size;
    fn compute_offset(
        &self,
        bounds: Rectangle,
        size: Size,
        previous: Rectangle,
        n: usize,
        count: usize,
    ) -> Point;

    // Provided method
    fn place(
        &self,
        view: &mut dyn View,
        size: Size,
        previous: Rectangle,
        n: usize,
        count: usize,
    ) -> Rectangle { ... }
}
Expand description

Helper trait that describes a linear layout orientation.

Required Associated Types§

Source

type Secondary: SecondaryAlignment + Alignment

Secondary alignment that will be applied to all the views

Required Methods§

Source

fn destructure_size(size: Size) -> (u32, u32)

Destructure Size into (primary_size, secondary_size)

Source

fn create_size(primary: u32, secondary: u32) -> Size

Create a Size from primary and secondary size values

Source

fn compute_offset( &self, bounds: Rectangle, size: Size, previous: Rectangle, n: usize, count: usize, ) -> Point

Computes translation for the next view.

Provided Methods§

Source

fn place( &self, view: &mut dyn View, size: Size, previous: Rectangle, n: usize, count: usize, ) -> Rectangle

Place view

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<Secondary, Spacing> Orientation for Horizontal<Secondary, Spacing>

Source§

type Secondary = Secondary

Source§

impl<Secondary, Spacing> Orientation for Vertical<Secondary, Spacing>

Source§

type Secondary = Secondary