[−][src]Struct tui_temp_fork::layout::Layout
Methods
impl Layout
[src]
pub fn constraints<C>(self, constraints: C) -> Layout where
C: Into<Vec<Constraint>>,
[src]
C: Into<Vec<Constraint>>,
pub fn margin(self, margin: u16) -> Layout
[src]
pub fn horizontal_margin(self, horizontal: u16) -> Layout
[src]
pub fn vertical_margin(self, vertical: u16) -> Layout
[src]
pub fn direction(self, direction: Direction) -> Layout
[src]
pub fn split(self, area: Rect) -> Vec<Rect>
[src]
Wrapper function around the cassowary-rs solver to be able to split a given area into smaller ones based on the preferred widths or heights and the direction.
Examples
let chunks = Layout::default() .direction(Direction::Vertical) .constraints([Constraint::Length(5), Constraint::Min(0)].as_ref()) .split(Rect { x: 2, y: 2, width: 10, height: 10, }); assert_eq!( chunks, vec![ Rect { x: 2, y: 2, width: 10, height: 5 }, Rect { x: 2, y: 7, width: 10, height: 5 } ] ); let chunks = Layout::default() .direction(Direction::Horizontal) .constraints([Constraint::Ratio(1, 3), Constraint::Ratio(2, 3)].as_ref()) .split(Rect { x: 0, y: 0, width: 9, height: 2, }); assert_eq!( chunks, vec![ Rect { x: 0, y: 0, width: 3, height: 2 }, Rect { x: 3, y: 0, width: 6, height: 2 } ] );
Trait Implementations
impl Clone for Layout
[src]
impl Default for Layout
[src]
impl Eq for Layout
[src]
impl PartialEq<Layout> for Layout
[src]
impl Debug for Layout
[src]
impl Hash for Layout
[src]
Auto Trait Implementations
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnwindSafe for Layout
impl RefUnwindSafe for Layout
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,