Expose chunks and chunk contents
This commit is contained in:
parent
26bf89023e
commit
f0af4ddc40
1 changed files with 12 additions and 0 deletions
|
|
@ -15,6 +15,14 @@ impl Chunk {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn string(&self) -> &str {
|
||||
&self.string
|
||||
}
|
||||
|
||||
pub fn style(&self) -> ContentStyle {
|
||||
self.style
|
||||
}
|
||||
|
||||
pub fn plain<S: ToString>(string: S) -> Self {
|
||||
Self::new(string, ContentStyle::default())
|
||||
}
|
||||
|
|
@ -81,6 +89,10 @@ impl Styled {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn chunks(&self) -> &[Chunk] {
|
||||
&self.0
|
||||
}
|
||||
|
||||
pub fn text(&self) -> String {
|
||||
self.0.iter().flat_map(|c| c.string.chars()).collect()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue