output: refactor Content and Render traits

This commit is contained in:
🪞👃🪞 2025-09-06 08:46:52 +03:00
parent 74b3af2212
commit 1c21a85f27
24 changed files with 346 additions and 613 deletions

View file

@ -15,7 +15,7 @@ impl<A, B> Bsp<A, B> {
#[inline] pub const fn a (a: A, b: B) -> Self { Self(Above, a, b) }
#[inline] pub const fn b (a: A, b: B) -> Self { Self(Below, a, b) }
}
impl<E: Output, A: Content<E>, B: Content<E>> Content<E> for Bsp<A, B> {
impl<E: Output, A: Render<E>, B: Render<E>> Render<E> for Bsp<A, B> {
fn layout (&self, outer: E::Area) -> E::Area { let [_, _, c] = self.areas(outer); c }
fn render (&self, to: &mut E) {
let [area_a, area_b, _] = self.areas(to.area());
@ -26,11 +26,11 @@ impl<E: Output, A: Content<E>, B: Content<E>> Content<E> for Bsp<A, B> {
}
}
}
impl<E: Output, A: Content<E>, B: Content<E>> BspAreas<E, A, B> for Bsp<A, B> {
impl<E: Output, A: Render<E>, B: Render<E>> BspAreas<E, A, B> for Bsp<A, B> {
fn direction (&self) -> Direction { self.0 }
fn contents (&self) -> (&A, &B) { (&self.1, &self.2) }
}
pub trait BspAreas<E: Output, A: Content<E>, B: Content<E>> {
pub trait BspAreas<E: Output, A: Render<E>, B: Render<E>> {
fn direction (&self) -> Direction;
fn contents (&self) -> (&A, &B);
fn areas (&self, outer: E::Area) -> [E::Area;3] {