summaryrefslogtreecommitdiff
path: root/src/model/styles.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-02 15:41:39 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-02 15:45:18 +0100
commit9bc90c371fb41a2d6dc08eb4673e5be15f829514 (patch)
tree454a47ce82c2229e79a139a8bdeaed9add1e0a14 /src/model/styles.rs
parent5110a41de1ca2236739ace2d37a1af912bb029f1 (diff)
Introspection
Diffstat (limited to 'src/model/styles.rs')
-rw-r--r--src/model/styles.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/model/styles.rs b/src/model/styles.rs
index 80ec0d1e..37596b8d 100644
--- a/src/model/styles.rs
+++ b/src/model/styles.rs
@@ -17,7 +17,7 @@ use crate::util::ReadableTypeId;
use crate::World;
/// A map of style properties.
-#[derive(Default, Clone, PartialEq, Hash)]
+#[derive(Default, Clone, Hash)]
pub struct StyleMap(Vec<Style>);
impl StyleMap {
@@ -117,7 +117,7 @@ impl Debug for StyleMap {
}
/// A single style property, recipe or barrier.
-#[derive(Clone, PartialEq, Hash)]
+#[derive(Clone, Hash)]
pub enum Style {
/// A style property originating from a set rule or constructor.
Property(Property),
@@ -302,7 +302,7 @@ impl Debug for KeyId {
}
/// A show rule recipe.
-#[derive(Clone, PartialEq, Hash)]
+#[derive(Clone, Hash)]
pub struct Recipe {
/// The span errors are reported with.
pub span: Span,
@@ -374,6 +374,11 @@ pub enum Selector {
}
impl Selector {
+ /// Define a simple node selector.
+ pub fn node<T: 'static>() -> Self {
+ Self::Node(NodeId::of::<T>(), None)
+ }
+
/// Define a simple text selector.
pub fn text(text: &str) -> Self {
Self::Regex(Regex::new(&regex::escape(text)).unwrap())
@@ -399,7 +404,7 @@ impl Selector {
}
/// A show rule transformation that can be applied to a match.
-#[derive(Debug, Clone, PartialEq, Hash)]
+#[derive(Debug, Clone, Hash)]
pub enum Transform {
/// Replacement content.
Content(Content),