pub struct Span { /* private fields */ }Expand description
A span consists of a list of styles to apply to an inner list of inline content.
Implementations§
Source§impl Span
impl Span
Sourcepub fn with_style(inner: &str, style: SpanStyle) -> Self
pub fn with_style(inner: &str, style: SpanStyle) -> Self
Create a new span, with the provided style, that includes a Text instance.
Sourcepub fn with_styles(inner: &str, styles: Vec<SpanStyle>) -> Self
pub fn with_styles(inner: &str, styles: Vec<SpanStyle>) -> Self
Create a new span, with the provided styles, that includes a Text instance.
Sourcepub fn inner_with_style(inner: InlineContent, style: SpanStyle) -> Self
pub fn inner_with_style(inner: InlineContent, style: SpanStyle) -> Self
Create a new span, with the provided style, that includes a InlineContent instance.
Sourcepub fn inner_with_styles(inner: InlineContent, styles: Vec<SpanStyle>) -> Self
pub fn inner_with_styles(inner: InlineContent, styles: Vec<SpanStyle>) -> Self
Create a new span, with the provided style, that includes a InlineContent instance.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Span
impl<'de> Deserialize<'de> for Span
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<InlineContent> for Span
impl From<InlineContent> for Span
Source§fn from(value: InlineContent) -> Self
fn from(value: InlineContent) -> Self
Converts to this type from the input type.
Source§impl From<Vec<InlineContent>> for Span
impl From<Vec<InlineContent>> for Span
Source§fn from(value: Vec<InlineContent>) -> Self
fn from(value: Vec<InlineContent>) -> Self
Converts to this type from the input type.
Source§impl HasInlineContent for Span
impl HasInlineContent for Span
Source§fn link(inner: HyperLink) -> Self
fn link(inner: HyperLink) -> Self
Create a new inline content container from the provided
HyperLink content item.Source§fn image(inner: Image) -> Self
fn image(inner: Image) -> Self
Create a new inline content container from the provided
Image content item.Source§fn text(inner: Text) -> Self
fn text(inner: Text) -> Self
Create a new inline content container from the provided
Text content item.Source§fn math(inner: Math) -> Self
fn math(inner: Math) -> Self
Create a new inline content container from the provided
Math content item.Source§fn text_str(inner: &str) -> Self
fn text_str(inner: &str) -> Self
Create a new inline content container from the provided string (into
Text) content item.Source§fn character(inner: Character) -> Self
fn character(inner: Character) -> Self
Create a new inline content container from the provided
Character content item.Source§fn line_break() -> Self
fn line_break() -> Self
Create a new inline content container with a line break.
Source§fn span(span: Span) -> Self
fn span(span: Span) -> Self
Create a new inline content container from the provided
Span content item.Source§fn add_link(&mut self, inner: HyperLink) -> &mut Self
fn add_link(&mut self, inner: HyperLink) -> &mut Self
Add the provided
HyperLink to this container’s inner content.Source§fn add_image(&mut self, inner: Image) -> &mut Self
fn add_image(&mut self, inner: Image) -> &mut Self
Add the provided
Image to this container’s inner content.Source§fn add_text(&mut self, inner: Text) -> &mut Self
fn add_text(&mut self, inner: Text) -> &mut Self
Add the provided
Text to this container’s inner content.Source§fn add_text_str(&mut self, inner: &str) -> &mut Self
fn add_text_str(&mut self, inner: &str) -> &mut Self
Add the provided string (as
Text) to this container’s inner content.Source§fn add_math(&mut self, inner: Math) -> &mut Self
fn add_math(&mut self, inner: Math) -> &mut Self
Add the provided
Math to this container’s inner content.Source§fn add_character(&mut self, inner: Character) -> &mut Self
fn add_character(&mut self, inner: Character) -> &mut Self
Add the provided
Character to this container’s inner content.Source§fn add_non_breaking_space(&mut self) -> &mut Self
fn add_non_breaking_space(&mut self) -> &mut Self
Add a single non-breaking space to this container’s inner content.
Source§fn add_line_break(&mut self) -> &mut Self
fn add_line_break(&mut self) -> &mut Self
Add a
LineBreak to this container’s inner content.Source§fn add_span(&mut self, inner: Span) -> &mut Self
fn add_span(&mut self, inner: Span) -> &mut Self
Add the provided
Span to this container’s inner content.Source§fn plain(inner: InlineContent) -> Self
fn plain(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::Plain applied to the
provided content.Source§fn plain_str(inner: &str) -> Self
fn plain_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::Plain applied to the
provided string as a Text instance.Source§fn italic(inner: InlineContent) -> Self
fn italic(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::Italic applied to the
provided content.Source§fn italic_str(inner: &str) -> Self
fn italic_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::Italic applied to the
provided string as a Text instance.Source§fn bold(inner: InlineContent) -> Self
fn bold(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::Bold applied to the
provided content.Source§fn bold_str(inner: &str) -> Self
fn bold_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::Bold applied to the
provided string as a Text instance.Source§fn mono(inner: InlineContent) -> Self
fn mono(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::Mono applied to the
provided content.Source§fn mono_str(inner: &str) -> Self
fn mono_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::Mono applied to the
provided string as a Text instance.Source§fn code(inner: InlineContent) -> Self
fn code(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::Code applied to the
provided content.Source§fn code_str(inner: &str) -> Self
fn code_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::Code applied to the
provided string as a Text instance.Source§fn strikethrough(inner: InlineContent) -> Self
fn strikethrough(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::Strikethrough applied to the
provided content.Source§fn strikethrough_str(inner: &str) -> Self
fn strikethrough_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::Strikethrough applied to the
provided string as a Text instance.Source§fn underline(inner: InlineContent) -> Self
fn underline(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::Underline applied to the
provided content.Source§fn underline_str(inner: &str) -> Self
fn underline_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::Underline applied to the
provided string as a Text instance.Source§fn small_caps(inner: InlineContent) -> Self
fn small_caps(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::SmallCaps applied to the
provided content.Source§fn small_caps_str(inner: &str) -> Self
fn small_caps_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::SmallCaps applied to the
provided string as a Text instance.Source§fn superscript(inner: InlineContent) -> Self
fn superscript(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::Superscript applied to the
provided content.Source§fn superscript_str(inner: &str) -> Self
fn superscript_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::Superscript applied to the
provided string as a Text instance.Source§fn subscript(inner: InlineContent) -> Self
fn subscript(inner: InlineContent) -> Self
Create a new inline content container as a
Span, with TextStyle::Subscript applied to the
provided content.Source§fn subscript_str(inner: &str) -> Self
fn subscript_str(inner: &str) -> Self
Create a new inline content container as a
Span, with TextStyle::Subscript applied to the
provided string as a Text instance.Source§fn unformatted_string(&self) -> String
fn unformatted_string(&self) -> String
Return a string that is simply the
Text instances (recursively) concatenated. This removes
any style information and non-text instances such as images or links.Source§impl HasInnerContent<InlineContent> for Span
impl HasInnerContent<InlineContent> for Span
Source§fn inner(&self) -> &Vec<InlineContent>
fn inner(&self) -> &Vec<InlineContent>
Return a reference to the inner value.
Source§fn into_inner(self) -> Vec<InlineContent>
fn into_inner(self) -> Vec<InlineContent>
Return the inner value, consuming
self.Source§fn inner_mut(&mut self) -> &mut Vec<InlineContent>
fn inner_mut(&mut self) -> &mut Vec<InlineContent>
Return a mutable reference to the inner list of content.
Source§fn add_content(&mut self, content: InlineContent) -> Result<()>
fn add_content(&mut self, content: InlineContent) -> Result<()>
Add
content to the inner list of content. If there is some consistency condition that
would be broken by this addition an error will be returned.Source§impl HasStyles<SpanStyle> for Span
impl HasStyles<SpanStyle> for Span
Source§fn styles_mut(&mut self) -> &mut Vec<SpanStyle>
fn styles_mut(&mut self) -> &mut Vec<SpanStyle>
Return a mutable reference to the list of applied styles.
Source§fn add_style(&mut self, style: SpanStyle) -> Result<()>
fn add_style(&mut self, style: SpanStyle) -> Result<()>
Add
content to the list of applied styles. If there is some consistency condition that
would be broken by this addition an error will be returned.Source§fn has_styles(&self) -> bool
fn has_styles(&self) -> bool
Returns
true if the list of applied styles is not empty, else false.Source§impl Into<InlineContent> for Span
impl Into<InlineContent> for Span
Source§fn into(self) -> InlineContent
fn into(self) -> InlineContent
Converts this type into the (usually inferred) input type.
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
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