mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: big flat pt.9: down to 141, looking good!
This commit is contained in:
parent
e958b4a2d2
commit
d01aa7481b
7 changed files with 39 additions and 12 deletions
|
|
@ -21,6 +21,14 @@ pub trait Output<E: Engine> {
|
|||
Some($cb)
|
||||
}
|
||||
}
|
||||
impl<E: Engine, $($($L),*$($T $(: $U)?),*)?> Render<E> for $Struct $(<$($L,)* E, $($T),*>)? {
|
||||
fn min_size (&self, to: E::Size) -> Perhaps<E::Size> {
|
||||
self.content().map(|content|content.min_size(to)).unwrap_or(Ok(None))
|
||||
}
|
||||
fn render (&self, to: &mut E::Output) -> Usually<()> {
|
||||
self.content().map(|content|content.render(to)).unwrap_or(Ok(()))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Implement for a specific engine
|
||||
|
|
@ -39,6 +47,20 @@ pub trait Output<E: Engine> {
|
|||
Some($cb)
|
||||
}
|
||||
}
|
||||
impl $(<
|
||||
$($($L),+)?
|
||||
$($($T$(:$U)?),+)?
|
||||
>)? Render<$E> for $Struct $(<
|
||||
$($($L),+)?
|
||||
$($($T),+)?
|
||||
>)? {
|
||||
fn min_size (&self, to: <$E as Engine>::Size) -> Perhaps<<$E as Engine>::Size> {
|
||||
self.content().map(|content|content.min_size(to)).unwrap_or(Ok(None))
|
||||
}
|
||||
fn render (&self, to: &mut <$E as Engine>::Output) -> Usually<()> {
|
||||
self.content().map(|content|content.render(to)).unwrap_or(Ok(()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,7 +367,6 @@ pub fn buffer_update (buf: &mut Buffer, area: [u16;4], callback: &impl Fn(&mut C
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/// Define a key
|
||||
pub const fn key (code: KeyCode) -> KeyEvent {
|
||||
let modifiers = KeyModifiers::NONE;
|
||||
|
|
@ -391,6 +390,7 @@ pub const fn shift (key: KeyEvent) -> KeyEvent {
|
|||
KeyEvent { modifiers: key.modifiers.union(KeyModifiers::SHIFT), ..key }
|
||||
}
|
||||
|
||||
/*
|
||||
/// Define a keymap
|
||||
#[macro_export] macro_rules! keymap {
|
||||
($T:ty { $([$k:ident $(($char:literal))?, $m:ident, $n: literal, $d: literal, $f: expr]),* $(,)? }) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue