pub struct StackContainer { /* private fields */ }
๐Deprecated: Use tui-framework-experiment instead
Expand description
A container that stacks widgets in a given direction
ยงExamples
use ratatui::prelude::*;
use ratatui::widgets::*;
use ratatui_widgets::StackContainer;
let mut stack = StackContainer::horizontal();
stack.push(Box::new(Paragraph::new("Left")), Constraint::Fill(1));
stack.push(Box::new(Paragraph::new("Center")), Constraint::Fill(2));
stack.push(Box::new(Paragraph::new("Right")), Constraint::Fill(1));
// or
let stack = StackContainer::horizontal().with_widgets(vec![
(Box::new(Paragraph::new("Left")), Constraint::Fill(1)),
(Box::new(Paragraph::new("Center")), Constraint::Fill(2)),
(Box::new(Paragraph::new("Right")), Constraint::Fill(1)),
]);
Implementationsยง
Sourceยงimpl StackContainer
impl StackContainer
pub fn new(direction: Direction) -> Self
๐Deprecated: Use tui-framework-experiment instead
pub fn horizontal() -> Self
๐Deprecated: Use tui-framework-experiment instead
pub fn vertical() -> Self
๐Deprecated: Use tui-framework-experiment instead
pub fn with_margin(self, margin: u16) -> Self
๐Deprecated: Use tui-framework-experiment instead
pub fn with_spacing(self, spacing: u16) -> Self
๐Deprecated: Use tui-framework-experiment instead
pub fn with_flex(self, flex: Flex) -> Self
๐Deprecated: Use tui-framework-experiment instead
pub fn with_widget( self, widget: Box<dyn WidgetRef>, constraint: Constraint, ) -> Self
๐Deprecated: Use tui-framework-experiment instead
pub fn with_widgets( self, widgets: Vec<(Box<dyn WidgetRef>, Constraint)>, ) -> Self
๐Deprecated: Use tui-framework-experiment instead
pub fn push(&mut self, widget: Box<dyn WidgetRef>, constraint: Constraint)
๐Deprecated: Use tui-framework-experiment instead
pub fn remove(&mut self, index: usize)
๐Deprecated: Use tui-framework-experiment instead
Trait Implementationsยง
Sourceยงimpl Debug for StackContainer
impl Debug for StackContainer
Sourceยงimpl Default for StackContainer
impl Default for StackContainer
Sourceยงfn default() -> StackContainer
fn default() -> StackContainer
Returns the โdefault valueโ for a type. Read more
Auto Trait Implementationsยง
impl Freeze for StackContainer
impl !RefUnwindSafe for StackContainer
impl !Send for StackContainer
impl !Sync for StackContainer
impl Unpin for StackContainer
impl !UnwindSafe for StackContainer
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more