add Layout trait

This commit is contained in:
facile pop culture reference 2026-07-07 16:35:29 +03:00
parent 1f60b43f61
commit 09463649c6
6 changed files with 208 additions and 222 deletions

View file

@ -73,23 +73,23 @@ pub fn iter_west <'a, S: Screen, D: 'a, I: Iterator<Item = D>, U: Draw<S>> (
pub fn row_south <S: Screen> (south: S::Unit, height: S::Unit, content: impl Draw<S>)
-> impl Draw<S>
{
y_push(south, h_exact(height, content))
content.exact_h(height).push_y(south)
}
pub fn row_north <S: Screen> (north: S::Unit, height: S::Unit, content: impl Draw<S>)
-> impl Draw<S>
{
y_pull(north, h_exact(height, content))
content.exact_h(height).pull_y(north)
}
pub fn col_east <S: Screen> (east: S::Unit, width: S::Unit, content: impl Draw<S>)
-> impl Draw<S>
{
x_push(east, h_exact(width, content))
content.exact_w(width).push_x(east)
}
pub fn col_west <S: Screen> (west: S::Unit, width: S::Unit, content: impl Draw<S>)
-> impl Draw<S>
{
x_pull(west, h_exact(width, content))
content.exact_w(width).pull_x(west)
}