pub trait SpanExt {
// Required method
fn span_iter(&self) -> SpanIter<'_> ⓘ;
}
Expand description
An extension trait that adds a method for creating a SpanIter
Required Methods§
Sourcefn span_iter(&self) -> SpanIter<'_> ⓘ
fn span_iter(&self) -> SpanIter<'_> ⓘ
Produces a SpanIter
from &self
§Examples
use mc_legacy_formatting::{SpanExt, Span, Color, Styles};
let s = "§4This will be dark red §oand italic";
let mut span_iter = s.span_iter();
assert_eq!(span_iter.next().unwrap(), Span::new_styled("This will be dark red ", Color::DarkRed, Styles::empty()));
assert_eq!(span_iter.next().unwrap(), Span::new_styled("and italic", Color::DarkRed, Styles::ITALIC));
assert!(span_iter.next().is_none());