LinearLayout

Struct LinearLayout 

Source
pub struct LinearLayout { /* private fields */ }
Expand description

A layout that uses a linear algorithm, with optional wrapping

Implementations§

Source§

impl LinearLayout

Source

pub const fn new(axis: Axis) -> Self

Create a new LinearLayout builder using this Axis

Source

pub const fn axis(self, axis: Axis) -> Self

Change the Axis of this builder

Source

pub const fn anchor(self, anchor: Anchor2) -> Self

Set the anchor for this builder.

An anchor is where the layout starts from

e.g.:

Source

pub const fn horizontal_anchor(self, anchor: Anchor) -> Self

Set the horizontal anchor for this builder

A horizontal anchor where where on the x axis the layout begins

Source

pub const fn vertical_anchor(self, anchor: Anchor) -> Self

Set the vertical anchor for this builder

A vertical anchor where where on the y axis the layout begins

Source

pub const fn horizontal() -> Self

Create a default horizontal layout builder

Source

pub const fn vertical() -> Self

Create a default vertical layout builder

Source

pub const fn wrap(self, wrap: bool) -> Self

Should this layout wrap?

Source

pub const fn spacing(self, spacing: Vec2) -> Self

The spacing for the layout.

Spacing is the gap between 2 elements.

  • spacing.x is the horizontal spacing
  • spacing.y is the vertical spacing
Source

pub fn layout(self, rect: Rect) -> LinearAllocator

Construct the LinearAllocator from this type

This takes in the target Rect that the allocator will fit everything into.

Trait Implementations§

Source§

impl Clone for LinearLayout

Source§

fn clone(&self) -> LinearLayout

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for LinearLayout

The default configuration for a LinearLayout is:

  • horizontal
  • no wrapping
  • starts at left-top
Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for LinearLayout

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.