From 4e822fa38337c21ac8b0cb550b8186b2c81acf4d Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Sat, 25 May 2019 03:07:56 -0700 Subject: [PATCH] Lazy Component generators have no need for capture semantics, so... we can make these simpler, behind the scenes. --- lifecycle/src/rsx/mod.rs | 6 +++++- lifecycle/src/rsx/virtual_node.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lifecycle/src/rsx/mod.rs b/lifecycle/src/rsx/mod.rs index 8ae096d..f55299a 100644 --- a/lifecycle/src/rsx/mod.rs +++ b/lifecycle/src/rsx/mod.rs @@ -40,7 +40,11 @@ pub enum RSX { impl RSX { /// Shorthand method for creating a new `RSX::VirtualNode` instance. Rarely should you call /// this yourself; the `rsx! {}` macro handles this for you. - pub fn node Arc> + Send + Sync + 'static>(tag: &'static str, create_fn: F, props: Props) -> RSX { + pub fn node( + tag: &'static str, + create_fn: fn() -> Arc>, + props: Props + ) -> RSX { RSX::VirtualNode(VirtualNode { tag: tag, create_component_fn: Arc::new(create_fn), diff --git a/lifecycle/src/rsx/virtual_node.rs b/lifecycle/src/rsx/virtual_node.rs index c2ec13b..b45ff05 100644 --- a/lifecycle/src/rsx/virtual_node.rs +++ b/lifecycle/src/rsx/virtual_node.rs @@ -19,7 +19,7 @@ pub struct VirtualNode { /// `Component` instances are created on-demand, if the reconciler deems it be so. This /// is a closure that should return an instance of the correct type. - pub create_component_fn: Arc Arc> + Send + Sync + 'static>, + pub create_component_fn: Arc Arc>>, /// A cached component instance, which is transferred between trees. Since `Component` /// instances are lazily created, this is an `Option`, and defaults to `None`.