Struct Span
pub struct Span<'a, Link = (), Font = Font> {
pub text: Cow<'a, str>,
pub size: Option<Pixels>,
pub line_height: Option<LineHeight>,
pub font: Option<Font>,
pub color: Option<Color>,
pub link: Option<Link>,
pub highlight: Option<Highlight>,
pub padding: Padding,
pub underline: bool,
pub strikethrough: bool,
}Expand description
A span of text.
Fields§
§text: Cow<'a, str>The Fragment of text.
size: Option<Pixels>The size of the Span in [Pixels].
line_height: Option<LineHeight>The [LineHeight] of the Span.
font: Option<Font>The font of the Span.
color: Option<Color>The [Color] of the Span.
link: Option<Link>The link of the Span.
highlight: Option<Highlight>The [Highlight] of the Span.
padding: PaddingThe [Padding] of the Span.
Currently, it only affects the bounds of the [Highlight].
underline: boolWhether the Span should be underlined or not.
strikethrough: boolWhether the Span should be struck through or not.
Implementations§
§impl<'a, Link, Font> Span<'a, Link, Font>
impl<'a, Link, Font> Span<'a, Link, Font>
pub fn new(fragment: impl IntoFragment<'a>) -> Span<'a, Link, Font>
pub fn new(fragment: impl IntoFragment<'a>) -> Span<'a, Link, Font>
Creates a new Span of text with the given text fragment.
pub fn line_height(
self,
line_height: impl Into<LineHeight>,
) -> Span<'a, Link, Font>
pub fn line_height( self, line_height: impl Into<LineHeight>, ) -> Span<'a, Link, Font>
Sets the [LineHeight] of the Span.
pub fn font_maybe(self, font: Option<impl Into<Font>>) -> Span<'a, Link, Font>
pub fn font_maybe(self, font: Option<impl Into<Font>>) -> Span<'a, Link, Font>
Sets the font of the Span, if any.
pub fn color_maybe(
self,
color: Option<impl Into<Color>>,
) -> Span<'a, Link, Font>
pub fn color_maybe( self, color: Option<impl Into<Color>>, ) -> Span<'a, Link, Font>
Sets the [Color] of the Span, if any.
pub fn link_maybe(self, link: Option<impl Into<Link>>) -> Span<'a, Link, Font>
pub fn link_maybe(self, link: Option<impl Into<Link>>) -> Span<'a, Link, Font>
Sets the link of the Span, if any.
pub fn background(
self,
background: impl Into<Background>,
) -> Span<'a, Link, Font>
pub fn background( self, background: impl Into<Background>, ) -> Span<'a, Link, Font>
Sets the [Background] of the Span.
pub fn background_maybe(
self,
background: Option<impl Into<Background>>,
) -> Span<'a, Link, Font>
pub fn background_maybe( self, background: Option<impl Into<Background>>, ) -> Span<'a, Link, Font>
Sets the [Background] of the Span, if any.
pub fn border(self, border: impl Into<Border>) -> Span<'a, Link, Font>
pub fn border(self, border: impl Into<Border>) -> Span<'a, Link, Font>
Sets the [Border] of the Span.
pub fn border_maybe(
self,
border: Option<impl Into<Border>>,
) -> Span<'a, Link, Font>
pub fn border_maybe( self, border: Option<impl Into<Border>>, ) -> Span<'a, Link, Font>
Sets the [Border] of the Span, if any.
pub fn padding(self, padding: impl Into<Padding>) -> Span<'a, Link, Font>
pub fn padding(self, padding: impl Into<Padding>) -> Span<'a, Link, Font>
Sets the [Padding] of the Span.
It only affects the background and border of the
Span, currently.
pub fn underline(self, underline: bool) -> Span<'a, Link, Font>
pub fn underline(self, underline: bool) -> Span<'a, Link, Font>
Sets whether the Span should be underlined or not.
pub fn strikethrough(self, strikethrough: bool) -> Span<'a, Link, Font>
pub fn strikethrough(self, strikethrough: bool) -> Span<'a, Link, Font>
Sets whether the Span should be struck through or not.