Skip to main content

Stack

Struct Stack 

Source
pub struct Stack<'a> { /* private fields */ }
Expand description

Widgets one above the other, each rendered at the full width.

A child whose lines are all empty is skipped, so it leaves no gap. A child may be borrowed, as in Stack::new().push(&widget), so a widget drawn in two places needs no clone.

Implementations§

Source§

impl<'a> Stack<'a>

Source

pub fn new() -> Self

A stack with no children and no space between them.

Source

pub fn spacing(self, lines: u16) -> Self

Leaves lines blank lines between consecutive children that render something. The default is none.

Source

pub fn push(self, child: impl Renderable + 'a) -> Self

Adds child below the others.

Trait Implementations§

Source§

impl Debug for Stack<'_>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for Stack<'a>

Source§

fn default() -> Self

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

impl Renderable for Stack<'_>

Source§

fn measure(&self, context: &Context) -> Measurement

The narrowest and widest this content can usefully be.
Source§

fn render(&self, context: &Context) -> Vec<Line>

Lines no wider than context.width(), except a word or cluster that the content’s overflow policy keeps whole.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Stack<'a>

§

impl<'a> !Send for Stack<'a>

§

impl<'a> !Sync for Stack<'a>

§

impl<'a> !UnwindSafe for Stack<'a>

§

impl<'a> Forget for Stack<'a>

§

impl<'a> Freeze for Stack<'a>

§

impl<'a> Move for Stack<'a>

§

impl<'a> Unpin for Stack<'a>

§

impl<'a> UnsafeUnpin for Stack<'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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.