Slight tweak to how gets created on demand. We use an now, for mutability/immutability needs in the reconciliation process. Not sure offhand how much the double lock of will affect things, but that's a problem for later.

This commit is contained in:
Ryan McGrath 2019-05-24 21:44:35 -07:00
parent 4bf89f5d91
commit c7ef19a943
No known key found for this signature in database
GPG key ID: 811674B62B666830
8 changed files with 53 additions and 43 deletions

View file

@ -3,7 +3,7 @@
//! uses these to build and alter UI; they're typically returned from `render()`
//! methods.
use std::sync::Arc;
use std::sync::{Arc, RwLock};
use std::fmt::{Debug, Display};
mod virtual_node;
@ -40,7 +40,7 @@ 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<F: Fn() -> Box<Component> + Send + Sync + 'static>(tag: &'static str, create_fn: F, props: Props) -> RSX {
pub fn node<F: Fn() -> Arc<RwLock<Component>> + Send + Sync + 'static>(tag: &'static str, create_fn: F, props: Props) -> RSX {
RSX::VirtualNode(VirtualNode {
tag: tag,
create_component_fn: Arc::new(create_fn),