mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
add iteration versions of row and col macros
This commit is contained in:
parent
ad39376659
commit
fd2e8f83f6
3 changed files with 57 additions and 50 deletions
|
|
@ -833,10 +833,22 @@ where
|
|||
($($expr:expr),* $(,)?) => { Layers::new(move|add|{ $(add(&$expr)?;)* Ok(()) }) }
|
||||
}
|
||||
#[macro_export] macro_rules! col {
|
||||
($($expr:expr),* $(,)?) => { Stack::down(move|add|{ $(add(&$expr)?;)* Ok(()) }) }
|
||||
($($expr:expr),* $(,)?) => { Stack::down(move|add|{ $(add(&$expr)?;)* Ok(()) }) };
|
||||
($pat:pat in $collection:expr => $item:expr) => {
|
||||
Stack::down(move |add|{
|
||||
for $pat in $collection { add(&$item)?; }
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
}
|
||||
#[macro_export] macro_rules! row {
|
||||
($($expr:expr),* $(,)?) => { Stack::right(move|add|{ $(add(&$expr)?;)* Ok(()) }) }
|
||||
($($expr:expr),* $(,)?) => { Stack::right(move|add|{ $(add(&$expr)?;)* Ok(()) }) };
|
||||
($pat:pat in $collection:expr => $item:expr) => {
|
||||
Stack::right(move |add|{
|
||||
for $pat in $collection { add(&$item)?; }
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// A binary split with fixed proportion
|
||||
|
|
|
|||
|
|
@ -466,8 +466,9 @@ impl<S: BorderStyle, W: Widget<Engine = Tui>> Content for Bordered<S, W> {
|
|||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
let style = self.0;
|
||||
Layers::new(move|add|{
|
||||
add(&Inset::XY(1, 1, &self.1 as &dyn Widget<Engine = Tui>))?;
|
||||
add(&Border(style))?;
|
||||
add(&Inset::XY(1, 1, &self.1 as &dyn Widget<Engine = Tui>))
|
||||
Ok(())
|
||||
}).fill_xy()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue