mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 21:56:42 +01:00
5 compile errors left
This commit is contained in:
parent
7bcd40b425
commit
b3f0f60400
13 changed files with 462 additions and 180 deletions
|
|
@ -54,6 +54,13 @@ impl<'a, E: Engine> Collect<'a, E> for Collection<'a, E> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Layers<'a, E: Engine>(pub &'a [&'a dyn Render<E>]);
|
||||
|
||||
// this actually works, except for the type inference
|
||||
//pub struct Layers<'a, E: Engine + 'a, I: std::iter::IntoIterator<Item = &'a dyn Render<E>>>(
|
||||
//pub &'a I
|
||||
//);
|
||||
|
||||
pub struct Layered<'a, E: Engine>(pub Collection<'a, E>);
|
||||
|
||||
impl<'a, E: Engine> Layered<'a, E> {
|
||||
|
|
|
|||
|
|
@ -57,13 +57,15 @@ impl<R, E: Engine> Render<E> for RwLock<R> where R: Render<E> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Boxed closures can be rendered.
|
||||
///
|
||||
/// Rendering unboxed closures should also be possible;
|
||||
/// but in practice implementing the trait for an unboxed
|
||||
/// `Fn` closure causes an impl conflict.
|
||||
impl<'a, E: Engine> Render<E> for Box<dyn Fn(&mut E) -> Perhaps<E::Rendered> + Send + Sync + 'a> {
|
||||
fn render (&self, to: &mut E) -> Perhaps<E::Rendered> {
|
||||
(*self)(to)
|
||||
}
|
||||
}
|
||||
// FIXME: components are now 2 thunks (layout and render).
|
||||
// maybe this resolves the conflict describe below?
|
||||
///// Boxed closures can be rendered.
|
||||
/////
|
||||
///// Rendering unboxed closures should also be possible;
|
||||
///// but in practice implementing the trait for an unboxed
|
||||
///// `Fn` closure causes an impl conflict.
|
||||
//impl<'a, E: Engine> Render<E> for Box<dyn Fn(&mut E) -> Perhaps<E::Rendered> + Send + Sync + 'a> {
|
||||
//fn render (&self, to: &mut E) -> Perhaps<E::Rendered> {
|
||||
//(*self)(to)
|
||||
//}
|
||||
//}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue