pub struct Layout { /* private fields */ }Expand description
A layout engine for dividing rectangular areas using constraints.
§Example
use tuxtui_core::layout::{Layout, Constraint, Direction};
use tuxtui_core::geometry::Rect;
let area = Rect::new(0, 0, 100, 50);
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Length(10),
Constraint::Fill(1),
Constraint::Length(5),
])
.split(area);Implementations§
Source§impl Layout
impl Layout
Sourcepub fn constraints<I>(self, constraints: I) -> Self
pub fn constraints<I>(self, constraints: I) -> Self
Set the constraints.
Sourcepub fn cache(self, capacity: NonZeroUsize) -> Self
Available on crate feature layout-cache only.
pub fn cache(self, capacity: NonZeroUsize) -> Self
layout-cache only.Enable caching with the given capacity.
Sourcepub fn horizontal<I>(constraints: I) -> Self
pub fn horizontal<I>(constraints: I) -> Self
Create a horizontal layout with the given constraints.
This is a convenience method for Layout::default().direction(Direction::Horizontal).constraints(...).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnwindSafe for Layout
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