feat: props memoization is more powerful

This commit solves the memoization , properly memoizing properties that don't have any generic parameters. This is a rough heuristic to prevent non-static lifetimes from creeping into props and breaking our minual lifetime management.

Props that have a generic parameter are opted-out of the `partialeq` requirement and props *without* lifetimes must implement partialeq. We're going to leave manual disabling of memoization for future work.
This commit is contained in:
Jonathan Kelley committed 2021-06-22 17:20:54 -04:00
1 parent 7102fe5f98
commit 73047fe956
37 files changed
+877 -977

No files matched your search

+23 -1
View File
@@ -3,6 +3,7 @@
//!
//! Renderers don't actually need to own the virtual dom (it's up to the implementer).
use crate::innerlude::RealDom;
use crate::{events::EventTrigger, virtual_dom::VirtualDom};
use crate::{innerlude::Result, prelude::*};
@@ -40,7 +41,7 @@ impl DebugRenderer {
Ok(())
}
pub fn step(&mut self, machine: &mut DiffMachine) -> Result<()> {
pub fn step<Dom: RealDom>(&mut self, machine: &mut DiffMachine<Dom>) -> Result<()> {
Ok(())
}
@@ -70,6 +71,27 @@ impl DebugRenderer {
pub fn trigger_listener(&mut self, id: usize) -> Result<()> {
Ok(())
}
pub fn render_nodes<'a, F>(&self, other: LazyNodes<'a, F>) -> Result<()>
where
F: for<'b> FnOnce(&'b NodeCtx<'a>) -> VNode<'a> + 'a,
{
Ok(())
}
}
pub struct DebugVNodeSource {
bump: Bump,
}
impl DebugVNodeSource {
fn new() -> Self {
Self { bump: Bump::new() }
}
fn render_nodes(&self) -> VNode {
// let ctx = NodeCtx
todo!()
}
}
#[cfg(test)]