1use super::style::Style;
2
3#[doc = include_str!("../docs/span.md")]
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct Span {
6 pub(crate) text: String,
7 pub(crate) style: Style,
8}
9
10impl Span {
11 pub fn new(text: impl Into<String>) -> Self {
12 Self { text: text.into(), style: Style::default() }
13 }
14
15 pub fn with_style(text: impl Into<String>, style: Style) -> Self {
16 Self { text: text.into(), style }
17 }
18
19 pub fn text(&self) -> &str {
20 &self.text
21 }
22
23 pub fn style(&self) -> Style {
24 self.style
25 }
26}