summaryrefslogtreecommitdiff
path: root/src/model/content.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/content.rs')
-rw-r--r--src/model/content.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/model/content.rs b/src/model/content.rs
index e6cb6d28..b8047ffa 100644
--- a/src/model/content.rs
+++ b/src/model/content.rs
@@ -6,8 +6,8 @@ use std::ops::{Add, AddAssign};
use std::sync::Arc;
use comemo::Tracked;
+use ecow::{EcoString, EcoVec};
use siphasher::sip128::{Hasher128, SipHasher};
-use thin_vec::ThinVec;
use typst_macros::node;
use super::{
@@ -16,7 +16,7 @@ use super::{
};
use crate::diag::{SourceResult, StrResult};
use crate::syntax::Span;
-use crate::util::{EcoString, ReadableTypeId};
+use crate::util::ReadableTypeId;
use crate::World;
/// Composable representation of styled content.
@@ -24,7 +24,7 @@ use crate::World;
pub struct Content {
obj: Arc<dyn Bounds>,
span: Option<Span>,
- modifiers: ThinVec<Modifier>,
+ modifiers: EcoVec<Modifier>,
}
/// Modifiers that can be attached to content.
@@ -67,9 +67,9 @@ impl Content {
/// Attach a label to the content.
pub fn labelled(mut self, label: Label) -> Self {
- for modifier in &mut self.modifiers {
- if let Modifier::Label(prev) = modifier {
- *prev = label;
+ for (i, modifier) in self.modifiers.iter().enumerate() {
+ if matches!(modifier, Modifier::Label(_)) {
+ self.modifiers.make_mut()[i] = Modifier::Label(label);
return self;
}
}
@@ -407,7 +407,7 @@ pub trait Node: 'static + Capable {
Content {
obj: Arc::new(self),
span: None,
- modifiers: ThinVec::new(),
+ modifiers: EcoVec::new(),
}
}