Skip to main content

Group

Struct Group 

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

A container that groups multiple renderables together.

Group implements the Renderable trait, allowing you to combine multiple renderables into a single unit. Each child is rendered in sequence with optional separators.

Implementations§

Source§

impl<'a> Group<'a>

Source

pub fn new() -> Self

Create a new empty group.

Source

pub fn push<R: Renderable + 'a>(self, renderable: R) -> Self

Add a renderable to the group.

The renderable is boxed and stored. You can add any type that implements the Renderable trait.

Source

pub fn push_boxed(self, renderable: Box<dyn Renderable + 'a>) -> Self

Add a boxed renderable to the group.

Source

pub fn fit(self, fit: bool) -> Self

Set whether to fit items inline when possible.

When fit is true, items that fit on the same line are rendered together. When false (default), each item gets its own line.

Source

pub fn is_empty(&self) -> bool

Check if the group is empty.

Source

pub fn len(&self) -> usize

Return the number of items in the group.

Trait Implementations§

Source§

impl<'a> Default for Group<'a>

Source§

fn default() -> Group<'a>

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

impl Renderable for Group<'_>

Source§

fn render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment<'_>>

Render the object to a list of segments.

Auto Trait Implementations§

§

impl<'a> Freeze for Group<'a>

§

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

§

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

§

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

§

impl<'a> Unpin for Group<'a>

§

impl<'a> UnsafeUnpin for Group<'a>

§

impl<'a> !UnwindSafe for Group<'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 = 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.