mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-09-19 13:36:42 +02:00
add origin and align methods to Layout trait
This commit is contained in:
parent
09463649c6
commit
13c886d9e0
18 changed files with 333 additions and 248 deletions
|
|
@ -12,9 +12,9 @@ impl<T: Screen, F: FnOnce(&mut T)->Perhaps<XYWH<T::Unit>>> Draw<T> for Thunk<T,
|
|||
/// Basic [Draw]able closure.
|
||||
///
|
||||
/// ```
|
||||
/// # use tengri::{draw::*, term::*};
|
||||
/// # fn test () -> impl tengri::draw::Draw<tengri::term::Tui> {
|
||||
/// thunk(|to: &mut Tui|Ok(to.1))
|
||||
/// # use tengri::*;
|
||||
/// # fn test () -> impl Draw<Tui> {
|
||||
/// thunk(|to: &mut Tui|Ok(Some(to.1)))
|
||||
/// # }
|
||||
/// ```
|
||||
pub const fn thunk <T: Screen, F: FnOnce(&mut T)->Perhaps<XYWH<T::Unit>>> (
|
||||
|
|
@ -26,8 +26,8 @@ pub const fn thunk <T: Screen, F: FnOnce(&mut T)->Perhaps<XYWH<T::Unit>>> (
|
|||
/// Only render when condition is true.
|
||||
///
|
||||
/// ```
|
||||
/// # use tengri::{draw::*, term::*};
|
||||
/// # fn test () -> impl tengri::draw::Draw<tengri::term::Tui> {
|
||||
/// # use tengri::*;
|
||||
/// # fn test () -> impl Draw<Tui> {
|
||||
/// when(true, "Yes")
|
||||
/// # }
|
||||
/// ```
|
||||
|
|
@ -38,8 +38,8 @@ pub const fn when <T: Screen> (condition: bool, draw: impl Draw<T>) -> impl Draw
|
|||
/// Render one thing if a condition is true and another false.
|
||||
///
|
||||
/// ```
|
||||
/// # use tengri::{draw::*, term::*};
|
||||
/// # fn test () -> impl tengri::draw::Draw<tengri::term::Tui> {
|
||||
/// # use tengri::*;
|
||||
/// # fn test () -> impl Draw<Tui> {
|
||||
/// either(true, "Yes", "No")
|
||||
/// # }
|
||||
/// ```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue