summaryrefslogtreecommitdiff
path: root/src/model/styles.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-06-13 23:16:40 +0200
committerLaurenz <laurmaedje@gmail.com>2022-06-14 13:53:02 +0200
commitc81e2a5f56eb262663f292578c683fba7f18251f (patch)
tree6c045a8dcbec5e75e01a15f970ef8cee6ff042d0 /src/model/styles.rs
parent891af17260a6750a74a102388a05e59cf1ffc3c1 (diff)
Many fixes
Diffstat (limited to 'src/model/styles.rs')
-rw-r--r--src/model/styles.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/model/styles.rs b/src/model/styles.rs
index 7d16f4ba..03cdcaac 100644
--- a/src/model/styles.rs
+++ b/src/model/styles.rs
@@ -216,7 +216,7 @@ impl StyleEntry {
}
}
- /// The highest-level kind of of structure the entry interrupts.
+ /// The highest-level kind of structure the entry interrupts.
pub fn interruption(&self) -> Option<Interruption> {
match self {
Self::Property(property) => property.interruption(),
@@ -328,7 +328,7 @@ impl<'a> StyleChain<'a> {
Ok(realized)
}
- /// Retrieve the current role
+ /// Retrieve the current role.
pub fn role(self) -> Option<Role> {
let mut depth = 0;
@@ -522,6 +522,15 @@ impl<T> StyleVec<T> {
}
}
+ /// Iterate over references to the contained items and associated style maps.
+ pub fn iter(&self) -> impl Iterator<Item = (&T, &StyleMap)> + '_ {
+ self.items().zip(
+ self.maps
+ .iter()
+ .flat_map(|(map, count)| iter::repeat(map).take(*count)),
+ )
+ }
+
/// Iterate over the contained items.
pub fn items(&self) -> std::slice::Iter<'_, T> {
self.items.iter()
@@ -535,15 +544,6 @@ impl<T> StyleVec<T> {
pub fn styles(&self) -> impl Iterator<Item = &StyleMap> {
self.maps.iter().map(|(map, _)| map)
}
-
- /// Iterate over references to the contained items and associated style maps.
- pub fn iter(&self) -> impl Iterator<Item = (&T, &StyleMap)> + '_ {
- self.items().zip(
- self.maps
- .iter()
- .flat_map(|(map, count)| iter::repeat(map).take(*count)),
- )
- }
}
impl<T> Default for StyleVec<T> {