Align

Struct Align 

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

A renderable that aligns its child within the available space.

Implementations§

Source§

impl Align

Source

pub fn left(child: impl Renderable + Send + Sync + 'static) -> Self

Create a new left-aligned wrapper.

Source

pub fn center(child: impl Renderable + Send + Sync + 'static) -> Self

Create a new center-aligned wrapper.

Source

pub fn right(child: impl Renderable + Send + Sync + 'static) -> Self

Create a new right-aligned wrapper.

Source

pub fn vertical(self, vertical: VerticalAlignment) -> Self

Set vertical alignment.

Source

pub fn height(self, height: usize) -> Self

Set height constraint.

Trait Implementations§

Source§

impl Renderable for Align

Source§

fn render(&self, context: &RenderContext) -> Vec<Segment>

Render this object to a sequence of segments. Read more
Source§

fn min_width(&self) -> usize

Get the minimum width required to render this object.
Source§

fn max_width(&self) -> usize

Get the maximum/natural width of this object.

Auto Trait Implementations§

§

impl Freeze for Align

§

impl !RefUnwindSafe for Align

§

impl Send for Align

§

impl Sync for Align

§

impl Unpin for Align

§

impl !UnwindSafe for Align

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> 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> Measurable for T
where T: Renderable,

Source§

fn measure(&self, width: usize) -> Measurement

Measure this renderable at the given width.
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.