add a lifetime to the properties trait and make the manual spread example work
This commit is contained in:
1 parent
fc8c25280a
commit
fa494349fe
7 files changed
+220
-198
No files matched your search
@@ -91,7 +91,7 @@ impl<'a, const A: bool> FragmentBuilder<'a, A> {
|
||||
/// })
|
||||
/// }
|
||||
/// ```
|
||||
impl<'a> Properties for FragmentProps<'a> {
|
||||
impl<'a> Properties<'_> for FragmentProps<'a> {
|
||||
type Builder = FragmentBuilder<'a, false>;
|
||||
const IS_STATIC: bool = false;
|
||||
fn builder(_cx: &ScopeState) -> Self::Builder {
|
||||
|
||||
@@ -896,8 +896,8 @@ impl<'a, T: IntoAttributeValue<'a>> IntoAttributeValue<'a> for Option<T> {
|
||||
pub trait HasAttributesBox<'a, T> {
|
||||
fn push_attribute(
|
||||
self,
|
||||
name: &str,
|
||||
ns: Option<&str>,
|
||||
name: &'a str,
|
||||
ns: Option<&'static str>,
|
||||
attr: impl IntoAttributeValue<'a>,
|
||||
volatile: bool,
|
||||
) -> T;
|
||||
|
||||
@@ -32,7 +32,7 @@ use crate::innerlude::*;
|
||||
/// data: &'a str
|
||||
/// }
|
||||
/// ```
|
||||
pub trait Properties: Sized {
|
||||
pub trait Properties<'a>: Sized {
|
||||
/// The type of the builder for this component.
|
||||
/// Used to create "in-progress" versions of the props.
|
||||
type Builder;
|
||||
@@ -41,7 +41,7 @@ pub trait Properties: Sized {
|
||||
const IS_STATIC: bool;
|
||||
|
||||
/// Create a builder for this component.
|
||||
fn builder(cx: &ScopeState) -> Self::Builder;
|
||||
fn builder(cx: &'a ScopeState) -> Self::Builder;
|
||||
|
||||
/// Memoization can only happen if the props are valid for the 'static lifetime
|
||||
///
|
||||
@@ -51,7 +51,7 @@ pub trait Properties: Sized {
|
||||
unsafe fn memoize(&self, other: &Self) -> bool;
|
||||
}
|
||||
|
||||
impl Properties for () {
|
||||
impl Properties<'_> for () {
|
||||
type Builder = EmptyBuilder;
|
||||
const IS_STATIC: bool = true;
|
||||
fn builder(_cx: &ScopeState) -> Self::Builder {
|
||||
@@ -70,8 +70,8 @@ impl EmptyBuilder {
|
||||
|
||||
/// This utility function launches the builder method so rsx! and html! macros can use the typed-builder pattern
|
||||
/// to initialize a component's props.
|
||||
pub fn fc_to_builder<'a, T: Properties + 'a>(
|
||||
cx: &ScopeState,
|
||||
pub fn fc_to_builder<'a, T: Properties<'a> + 'a>(
|
||||
cx: &'a ScopeState,
|
||||
_: fn(Scope<'a, T>) -> Element<'a>,
|
||||
) -> T::Builder {
|
||||
T::builder(cx)
|
||||
|
||||
@@ -423,7 +423,7 @@ impl<'src> ScopeState {
|
||||
fn_name: &'static str,
|
||||
) -> DynamicNode<'src>
|
||||
where
|
||||
P: Properties + 'child,
|
||||
P: Properties<'child> + 'child,
|
||||
'src: 'child,
|
||||
{
|
||||
let vcomp = VProps::new(component, P::memoize, props);
|
||||
|
||||
Reference in new issue
Block a user