pub enum Span<'a> {
Styled {
text: &'a str,
color: Color,
styles: Styles,
},
StrikethroughWhitespace {
text: &'a str,
color: Color,
styles: Styles,
},
Plain(&'a str),
}
Expand description
Variants§
Styled
A styled slice of text
Fields
StrikethroughWhitespace
An unbroken sequence of whitespace that was given the
STRIKETHROUGH
style.
The vanilla client renders whitespace with the STRIKETHROUGH
style
as a solid line; this variant allows for replicating that behavior.
Fields
§
styles: Styles
Styles applied to the whitespace (will contain at least
STRIKETHROUGH
)
Plain(&'a str)
An unstyled slice of text
This should be given a default style. The vanilla client
would use Color::White
and Styles::empty()
.
Implementations§
Source§impl<'a> Span<'a>
impl<'a> Span<'a>
Sourcepub fn new_plain(s: &'a str) -> Self
pub fn new_plain(s: &'a str) -> Self
Create a new Span::Plain
Sourcepub fn new_strikethrough_whitespace(
s: &'a str,
color: Color,
styles: Styles,
) -> Self
pub fn new_strikethrough_whitespace( s: &'a str, color: Color, styles: Styles, ) -> Self
Create a new Span::StrikethroughWhitespace
Sourcepub fn new_styled(s: &'a str, color: Color, styles: Styles) -> Self
pub fn new_styled(s: &'a str, color: Color, styles: Styles) -> Self
Create a new Span::Styled
Sourcepub fn wrap_colored(self) -> PrintSpanColored<'a>
pub fn wrap_colored(self) -> PrintSpanColored<'a>
Wraps this Span
in a type that enables colored printing
Trait Implementations§
Source§impl<'a> From<Span<'a>> for PrintSpanColored<'a>
impl<'a> From<Span<'a>> for PrintSpanColored<'a>
impl<'a> Copy for Span<'a>
impl<'a> Eq for Span<'a>
impl<'a> StructuralPartialEq for Span<'a>
Auto Trait Implementations§
impl<'a> Freeze for Span<'a>
impl<'a> RefUnwindSafe for Span<'a>
impl<'a> Send for Span<'a>
impl<'a> Sync for Span<'a>
impl<'a> Unpin for Span<'a>
impl<'a> UnwindSafe for Span<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more