Struct Align

Source
pub struct Align<A = ()> { /* private fields */ }
Expand description

Aligns one child within allocated space using Flutter-like factors.

x and y range from -1 (start/top) through 0 (center) to 1 (end/bottom). Finite values are clamped to that interval; NaN remains NaN and can propagate into layout offsets. With no child, the widget still expands to its constrained maximum size.

§Examples

use ailloli_ui_widgets::{layout::Align, text::Text};
let centered: Align<()> = Align::new(0.0, 0.0).child(Text::new("center"));
let _ = centered;

Implementations§

Source§

impl<A: 'static> Align<A>

Source

pub fn new(x: f32, y: f32) -> Self

Creates an empty alignment box and clamps finite factors to [-1, 1].

§Examples
use ailloli_ui_widgets::layout::Align;
let align: Align<()> = Align::new(-1.0, 1.0);
let _ = align;
Source

pub fn child(self, child: impl IntoView<A>) -> Self

Sets the single aligned child, replacing any previous child.

§Examples
use ailloli_ui_widgets::{layout::Align, text::Text};
let align: Align<()> = Align::new(0.0, 0.0).child(Text::new("child"));
let _ = align;

Trait Implementations§

Source§

impl<A: 'static> IntoView<A> for Align<A>

Converts the builder into a retained node containing zero or one child.

Source§

fn into_view(self) -> View<A>

Consumes a builder/value and returns its declarative view tree. Read more

Auto Trait Implementations§

§

impl<A> Freeze for Align<A>

§

impl<A = ()> !RefUnwindSafe for Align<A>

§

impl<A = ()> !Send for Align<A>

§

impl<A = ()> !Sync for Align<A>

§

impl<A> Unpin for Align<A>

§

impl<A = ()> !UnwindSafe for Align<A>

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, A> FlexItemExt<A> for T
where T: IntoView<A>,

Source§

fn flex_grow(self) -> View<A>

Sets flex-grow weight to one. Read more
Source§

fn flex_grow_by(self, value: f32) -> View<A>

Sets the dimensionless flex-grow weight. Read more
Source§

fn flex_shrink(self, value: f32) -> View<A>

Sets the dimensionless flex-shrink weight. Read more
Source§

fn flex_basis(self, value: impl Into<Length>) -> View<A>

Sets the preferred main-axis flex basis. Read more
Source§

fn align_self(self, value: AlignItems) -> View<A>

Overrides the parent cross-axis alignment for this view. Read more
Source§

fn fill_width(self) -> View<A>

Marks width as parent-fill in the view size hint. Read more
Source§

fn fill_height(self) -> View<A>

Marks height as parent-fill in the view size hint. Read more
Source§

fn fill(self) -> View<A>

Marks both axes as parent-fill in the view size hint. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T, A> IntoViewKeyExt<A> for T
where T: IntoView<A>,

§

fn key(self, key: impl Into<String>) -> View<A>

Converts self, assigns the owned key, and returns the view. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,