mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-04-25 13:40:43 +02:00
fix signatures of iter_ helpers
This commit is contained in:
parent
6c382e2627
commit
c9b9ff1519
3 changed files with 56 additions and 47 deletions
|
|
@ -11,6 +11,10 @@ pub fn rgb (r: u8, g: u8, b: u8) -> ItemColor {
|
|||
ItemColor { okhsl: rgb_to_okhsl(term), term }
|
||||
}
|
||||
|
||||
pub fn g (g: u8) -> Color {
|
||||
Color::Rgb(g, g, g)
|
||||
}
|
||||
|
||||
pub fn okhsl_to_rgb (color: Okhsl<f32>) -> Color {
|
||||
let Srgb { red, green, blue, .. }: Srgb<f32> = Srgb::from_color_unclamped(color);
|
||||
Color::Rgb((red * 255.0) as u8, (green * 255.0) as u8, (blue * 255.0) as u8,)
|
||||
|
|
|
|||
75
src/space.rs
75
src/space.rs
|
|
@ -424,22 +424,26 @@ pub const fn w_full <T: Screen> (a: impl Draw<T>) -> impl Draw<T> { a }
|
|||
pub const fn h_full <T: Screen> (a: impl Draw<T>) -> impl Draw<T> { a }
|
||||
|
||||
#[macro_export] macro_rules! north {
|
||||
($($tt:tt)*) => { unimplemented!() };
|
||||
($head:expr $(,)?) => { $head };
|
||||
($head:expr, $($tail:expr),* $(,)?) => { north($head, north!($($tail,)*)) };
|
||||
}
|
||||
#[macro_export] macro_rules! south {
|
||||
($($tt:tt)*) => { unimplemented!() };
|
||||
($head:expr $(,)?) => { $head };
|
||||
($head:expr, $($tail:expr),* $(,)?) => { south($head, south!($($tail,)*)) };
|
||||
}
|
||||
#[macro_export] macro_rules! east {
|
||||
($($tt:tt)*) => { unimplemented!() };
|
||||
($head:expr $(,)?) => { $head };
|
||||
($head:expr, $($tail:expr),* $(,)?) => { east($head, east!($($tail,)*)) };
|
||||
}
|
||||
#[macro_export] macro_rules! west {
|
||||
($($tt:tt)*) => { unimplemented!() };
|
||||
($head:expr $(, $tail:expr)* $(,)?) => { west($head, west!($($tail,)*)) };
|
||||
}
|
||||
#[macro_export] macro_rules! above {
|
||||
($($tt:tt)*) => { unimplemented!() };
|
||||
($head:expr $(, $tail:expr)* $(,)?) => { above($head, above!($($tail,)*)) };
|
||||
}
|
||||
#[macro_export] macro_rules! below {
|
||||
($($tt:tt)*) => { unimplemented!() };
|
||||
($head:expr $(,)?) => { $head };
|
||||
($head:expr, $($tail:expr),* $(,)?) => { below($head, below!($($tail,)*)) };
|
||||
}
|
||||
|
||||
/// Iterate over a collection of renderables:
|
||||
|
|
@ -453,44 +457,37 @@ pub const fn h_full <T: Screen> (a: impl Draw<T>) -> impl Draw<T> { a }
|
|||
/// ].iter(), |x|x);
|
||||
/// ```
|
||||
pub fn iter <
|
||||
T: Screen,
|
||||
S: Screen,
|
||||
D: Draw<S>,
|
||||
V: Fn()->I,
|
||||
I: Iterator<Item = dyn Draw<T>>,
|
||||
F: Fn(&dyn Draw<T>)->dyn Draw<T>,
|
||||
> (_items: V, _cb: F) -> impl Draw<T> {
|
||||
thunk(move|_to: &mut T|{ todo!() })
|
||||
I: Iterator<Item = D>,
|
||||
F: Fn(&D)->dyn Draw<S>,
|
||||
> (_items: V, _cb: F) -> impl Draw<S> {
|
||||
thunk(move|_to: &mut S|{ todo!() })
|
||||
}
|
||||
pub fn iter_north <
|
||||
T: Screen,
|
||||
V: Fn()->I,
|
||||
I: Iterator<Item = dyn Draw<T>>,
|
||||
F: Fn(&dyn Draw<T>)->dyn Draw<T>,
|
||||
> (_items: V, _cb: F) -> impl Draw<T> {
|
||||
thunk(move|_to: &mut T|{ todo!() })
|
||||
|
||||
pub fn iter_north <'a, S: Screen, D: 'a, I: Iterator<Item = D>, U: Draw<S>> (
|
||||
_iter: impl Fn()->I, _draw: impl Fn(D)->U,
|
||||
) -> impl Draw<S> {
|
||||
thunk(move|_to: &mut S|{ todo!() })
|
||||
}
|
||||
pub fn iter_east <
|
||||
T: Screen,
|
||||
V: Fn()->I,
|
||||
I: Iterator<Item = dyn Draw<T>>,
|
||||
F: Fn(&dyn Draw<T>)->dyn Draw<T>,
|
||||
> (_items: V, _cb: F) -> impl Draw<T> {
|
||||
thunk(move|_to: &mut T|{ todo!() })
|
||||
|
||||
pub fn iter_east <'a, S: Screen, D: 'a, I: Iterator<Item = D>, U: Draw<S>> (
|
||||
_iter: impl Fn()->I, _draw: impl Fn(D)->U,
|
||||
) -> impl Draw<S> {
|
||||
thunk(move|_to: &mut S|{ todo!() })
|
||||
}
|
||||
pub fn iter_south <
|
||||
T: Screen,
|
||||
V: Fn()->I,
|
||||
I: Iterator<Item = dyn Draw<T>>,
|
||||
F: Fn(&dyn Draw<T>)->dyn Draw<T>,
|
||||
> (_items: V, _cb: F) -> impl Draw<T> {
|
||||
thunk(move|_to: &mut T|{ todo!() })
|
||||
|
||||
pub fn iter_south <'a, S: Screen, D: 'a, I: Iterator<Item = D>, U: Draw<S>> (
|
||||
_iter: impl Fn()->I, _draw: impl Fn(D)->U,
|
||||
) -> impl Draw<S> {
|
||||
thunk(move|_to: &mut S|{ todo!() })
|
||||
}
|
||||
pub fn iter_west <
|
||||
T: Screen,
|
||||
V: Fn()->I,
|
||||
I: Iterator<Item = dyn Draw<T>>,
|
||||
F: Fn(&dyn Draw<T>)->dyn Draw<T>,
|
||||
> (_items: V, _cb: F) -> impl Draw<T> {
|
||||
thunk(move|_to: &mut T|{ todo!() })
|
||||
|
||||
pub fn iter_west <'a, S: Screen, D: 'a, I: Iterator<Item = D>, U: Draw<S>> (
|
||||
_iter: impl Fn()->I, _draw: impl Fn(D)->U,
|
||||
) -> impl Draw<S> {
|
||||
thunk(move|_to: &mut S|{ todo!() })
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue