wip: big flat pt.9: down to 141, looking good!

This commit is contained in:
🪞👃🪞 2024-12-30 20:43:22 +01:00
parent e958b4a2d2
commit d01aa7481b
7 changed files with 39 additions and 12 deletions

View file

@ -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(()))
}
}
}
}