mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
remove last color conversion from render loop
This commit is contained in:
parent
a31de6e819
commit
7ad574cf2a
9 changed files with 122 additions and 47 deletions
|
|
@ -1,10 +1,10 @@
|
|||
use crate::*;
|
||||
/// Show an item only when a condition is true.
|
||||
pub struct When<A>(pub bool, pub A);
|
||||
impl<A> When<A> { pub fn new (c: bool, a: A) -> Self { Self(c, a) } }
|
||||
impl<A> When<A> { #[inline] pub fn new (c: bool, a: A) -> Self { Self(c, a) } }
|
||||
/// Show one item if a condition is true and another if the condition is false
|
||||
pub struct Either<A, B>(pub bool, pub A, pub B);
|
||||
impl<A, B> Either<A, B> { pub fn new (c: bool, a: A, b: B) -> Self { Self(c, a, b) } }
|
||||
impl<A, B> Either<A, B> { #[inline] pub fn new (c: bool, a: A, b: B) -> Self { Self(c, a, b) } }
|
||||
try_from_expr!(<'a, E>: When<RenderBox<'a, E>>: |state, iter| {
|
||||
if let Some(Token { value: Value::Key("when"), .. }) = iter.peek() {
|
||||
let _ = iter.next().unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue