wip: bubbling

This commit is contained in:
Jonathan Kelley committed 2021-09-20 12:32:21 -04:00
1 parent c16b92ee7e
commit 7978a17419
12 files changed
+385 -363

No files matched your search

+26
View File
@@ -1,4 +1,5 @@
use std::cell::Cell;
use std::fmt::Display;
use crate::innerlude::*;
@@ -64,3 +65,28 @@ impl Future for YieldNow {
}
}
}
/// A component's unique identifier.
///
/// `ScopeId` is a `usize` that is unique across the entire VirtualDOM - but not unique across time. If a component is
/// unmounted, then the `ScopeId` will be reused for a new component.
#[derive(serde::Serialize, serde::Deserialize, Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct ScopeId(pub usize);
/// An Element's unique identifier.
///
/// `ElementId` is a `usize` that is unique across the entire VirtualDOM - but not unique across time. If a component is
/// unmounted, then the `ElementId` will be reused for a new component.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct ElementId(pub usize);
impl Display for ElementId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl ElementId {
pub fn as_u64(self) -> u64 {
self.0 as u64
}
}