diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-24 16:38:11 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-24 16:42:19 +0200 |
| commit | 89927d7de069169eeecfa091d6b77408b69fe188 (patch) | |
| tree | bd9172a9935f2e15214d82c36d2e411c3623b7f5 /src/model/show.rs | |
| parent | 8fbb11fc05b3313bf102c1f23693290661d00863 (diff) | |
`StyleSlot`, `KeyId` and `NodeId`
Diffstat (limited to 'src/model/show.rs')
| -rw-r--r-- | src/model/show.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/model/show.rs b/src/model/show.rs index 5f76ba19..d1365eb2 100644 --- a/src/model/show.rs +++ b/src/model/show.rs @@ -1,9 +1,8 @@ -use std::any::{Any, TypeId}; use std::fmt::{self, Debug, Formatter}; use std::hash::Hash; use std::sync::Arc; -use super::{Content, StyleChain}; +use super::{Content, NodeId, StyleChain}; use crate::diag::TypResult; use crate::eval::Dict; use crate::util::Prehashed; @@ -57,9 +56,9 @@ impl ShowNode { Self(Arc::new(Prehashed::new(node))) } - /// The type id of this node. - pub fn id(&self) -> TypeId { - self.0.as_any().type_id() + /// The id of this node. + pub fn id(&self) -> NodeId { + (**self.0).node_id() } } @@ -99,14 +98,14 @@ impl PartialEq for ShowNode { } trait Bounds: Show + Debug + Sync + Send + 'static { - fn as_any(&self) -> &dyn Any; + fn node_id(&self) -> NodeId; } impl<T> Bounds for T where T: Show + Debug + Hash + Sync + Send + 'static, { - fn as_any(&self) -> &dyn Any { - self + fn node_id(&self) -> NodeId { + NodeId::of::<Self>() } } |
