fix: extract dyn_bindings impl into DynBindings trait (#2619)

This commit is contained in:
ARSON 2024-06-12 06:07:56 -07:00 committed by GitHub
parent 00a42daa63
commit b22f3bb3bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View file

@ -285,6 +285,21 @@ pub trait DynAttrs {
impl DynAttrs for () {}
#[doc(hidden)]
pub trait DynBindings {
fn dyn_bindings<B: Into<Binding>>(
self,
_args: impl IntoIterator<Item = B>,
) -> Self
where
Self: Sized,
{
self
}
}
impl DynBindings for () {}
#[doc(hidden)]
pub trait PropsOrNoPropsBuilder {
type Builder;

View file

@ -543,7 +543,7 @@ impl ToTokens for Model {
}
}
impl #impl_generics #props_name #generics #where_clause {
impl #impl_generics ::leptos::DynBindings for #props_name #generics #where_clause {
fn dyn_bindings<B: Into<::leptos::leptos_dom::html::Binding>>(mut self, bindings: impl std::iter::IntoIterator<Item = B>) -> Self {
for binding in bindings.into_iter() {
let binding: ::leptos::leptos_dom::html::Binding = binding.into();