mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
sweeeeping sweep
This commit is contained in:
parent
c9b09b7dea
commit
e677d1d7d4
38 changed files with 766 additions and 691 deletions
|
|
@ -39,6 +39,60 @@ impl<E: Engine> Content<E> for () {}
|
|||
|
||||
impl<E: Engine, T: Content<E>> Content<E> for &T {}
|
||||
|
||||
impl<E: Engine, T: Content<E>> Content<E> for Option<T> {}
|
||||
|
||||
#[macro_export] macro_rules! render {
|
||||
(($self:ident:$Struct:ty) => $content:expr) => {
|
||||
impl <E: Engine> Content<E> for $Struct {
|
||||
fn content (&$self) -> Option<impl Content<E>> {
|
||||
Some($content)
|
||||
}
|
||||
}
|
||||
};
|
||||
(|$self:ident:$Struct:ident $(<
|
||||
$($L:lifetime),*
|
||||
$($T:ident $(:$Trait:path)?),*
|
||||
>)?, $to:ident | $render:expr) => {
|
||||
impl <$($($L),*)? E: Engine, $($T$(:$Trait)?),*> Content<E>
|
||||
for $Struct $(<$($L),* $($T),*>>)? {
|
||||
fn render (&$self, $to: &mut E::Output) {
|
||||
Some($render)
|
||||
}
|
||||
}
|
||||
};
|
||||
($Engine:ty:
|
||||
($self:ident:$Struct:ident $(<$(
|
||||
$($L:lifetime)?
|
||||
$($T:ident)?
|
||||
$(:$Trait:path)?
|
||||
),+>)?) => $content:expr
|
||||
) => {
|
||||
impl $(<$($($L)? $($T)? $(:$Trait)?),+>)? Content<$Engine>
|
||||
for $Struct $(<$($($L)? $($T)?),+>)?
|
||||
{
|
||||
fn content (&$self) -> Option<impl Content<$Engine>> {
|
||||
Some($content)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($Engine:ty:
|
||||
|$self:ident : $Struct:ident $(<$(
|
||||
$($L:lifetime)?
|
||||
$($T:ident)?
|
||||
$(:$Trait:path)?
|
||||
),+>)?, $to:ident| $render:expr
|
||||
) => {
|
||||
impl $(<$($($L)? $($T)? $(:$Trait)?),+>)? Content<$Engine>
|
||||
for $Struct $(<$($($L)? $($T)?),+>)?
|
||||
{
|
||||
fn render (&$self, $to: &mut <$Engine as Engine>::Output) {
|
||||
Some($render)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//impl<E: Engine, R: Render<E>> Render<E> for &R {}
|
||||
|
||||
//pub trait Render<E: Engine>: Send + Sync {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue