mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-12 23:57:09 +00:00
chore: fix adding attr todo for static types
This commit is contained in:
parent
412ecd6b1b
commit
d1a4bbe28e
2 changed files with 33 additions and 5 deletions
|
@ -530,6 +530,21 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> ToTemplate for BoxedView<T>
|
||||
where
|
||||
T: ToTemplate,
|
||||
{
|
||||
fn to_template(
|
||||
buf: &mut String,
|
||||
class: &mut String,
|
||||
style: &mut String,
|
||||
inner_html: &mut String,
|
||||
position: &mut Position,
|
||||
) {
|
||||
T::to_template(buf, class, style, inner_html, position);
|
||||
}
|
||||
}
|
||||
|
||||
/// A newtype around a view that allows us to get out of certain compile errors.
|
||||
///
|
||||
/// It is unlikely that you need this in your own work.
|
||||
|
@ -627,3 +642,18 @@ where
|
|||
self.into_inner().hydrate::<FROM_SERVER>(cursor, position)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ToTemplate for WrappedView<T>
|
||||
where
|
||||
T: ToTemplate,
|
||||
{
|
||||
fn to_template(
|
||||
buf: &mut String,
|
||||
class: &mut String,
|
||||
style: &mut String,
|
||||
inner_html: &mut String,
|
||||
position: &mut Position,
|
||||
) {
|
||||
T::to_template(buf, class, style, inner_html, position);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::{
|
||||
add_attr::AddAnyAttr, Mountable, Position, PositionState, Render,
|
||||
RenderHtml, ToTemplate,
|
||||
RenderHtml, ToTemplate, WrappedView,
|
||||
};
|
||||
use crate::{
|
||||
html::attribute::{Attribute, AttributeKey, AttributeValue, NextAttribute},
|
||||
|
@ -216,7 +216,7 @@ impl<R, const V: &'static str> AddAnyAttr<R> for Static<V>
|
|||
where
|
||||
R: Renderer,
|
||||
{
|
||||
type Output<SomeNewAttr: Attribute<R>> = Static<V>;
|
||||
type Output<SomeNewAttr: Attribute<R>> = WrappedView<Static<V>>;
|
||||
|
||||
fn add_any_attr<NewAttr: Attribute<R>>(
|
||||
self,
|
||||
|
@ -225,9 +225,7 @@ where
|
|||
where
|
||||
Self::Output<NewAttr>: RenderHtml<R>,
|
||||
{
|
||||
// TODO: there is a strange compiler thing that seems to prevent us returning Self here,
|
||||
// even though we've already said that Output is always the same as Self
|
||||
todo!()
|
||||
WrappedView::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue