From 2419a2ae9da3b9e918d6969daabbe08f52768e41 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Sat, 10 Dec 2022 21:18:44 -0600 Subject: [PATCH] WIP diffing templates --- packages/rsx/src/lib.rs | 284 +++++++++++++++++++++++++++++----------- 1 file changed, 208 insertions(+), 76 deletions(-) diff --git a/packages/rsx/src/lib.rs b/packages/rsx/src/lib.rs index c6dbd5862..5acded55b 100644 --- a/packages/rsx/src/lib.rs +++ b/packages/rsx/src/lib.rs @@ -19,7 +19,7 @@ mod hot_reloading_context; mod ifmt; mod node; -use std::{borrow::Borrow, hash::Hash}; +use std::{collections::HashMap, hash::Hash}; // Re-export the namespaces into each other pub use component::*; @@ -39,9 +39,7 @@ use syn::{ }; // interns a object into a static object, resusing the value if it already exists -fn intern<'a, T: Eq + Hash + Send + Sync + ?Sized + 'static>( - s: impl Into>, -) -> &'static T { +fn intern(s: impl Into>) -> &'static T { s.into().as_ref() } @@ -63,7 +61,7 @@ impl CallBody { /// the previous_location is the location of the previous template at the time the template was originally compiled. pub fn update_template( &self, - template: Option<&CallBody>, + template: Option>, location: &'static str, ) -> Option