Struct cursive::utils::span::SpannedString [−][src]
pub struct SpannedString<T> { /* fields omitted */ }
A string with associated spans.
Each span has an associated attribute T
.
Methods
impl SpannedString<Style>
[src]
impl SpannedString<Style>
pub fn plain<S>(content: S) -> Self where
S: Into<String>,
[src]
pub fn plain<S>(content: S) -> Self where
S: Into<String>,
Returns a plain StyledString without any style.
You got no style, Dutch. You know that.
pub fn styled<S, T>(content: S, style: T) -> Self where
S: Into<String>,
T: Into<Style>,
[src]
pub fn styled<S, T>(content: S, style: T) -> Self where
S: Into<String>,
T: Into<Style>,
Creates a new StyledString
using a single style for the entire text.
pub fn append_plain<S>(&mut self, text: S) where
S: Into<String>,
[src]
pub fn append_plain<S>(&mut self, text: S) where
S: Into<String>,
Appends the given plain text to self
.
pub fn append_styled<S, T>(&mut self, text: S, style: T) where
S: Into<String>,
T: Into<Style>,
[src]
pub fn append_styled<S, T>(&mut self, text: S, style: T) where
S: Into<String>,
T: Into<Style>,
Appends text
to self
, using style
.
impl SpannedString<()>
[src]
impl SpannedString<()>
pub fn plain<S>(content: S) -> Self where
S: Into<String>,
[src]
pub fn plain<S>(content: S) -> Self where
S: Into<String>,
Returns a simple spanned string without any attribute.
impl<T> SpannedString<T>
[src]
impl<T> SpannedString<T>
pub fn new() -> Self
[src]
pub fn new() -> Self
Returns an empty SpannedString
.
pub fn with_spans<S>(source: S, spans: Vec<IndexedSpan<T>>) -> Self where
S: Into<String>,
[src]
pub fn with_spans<S>(source: S, spans: Vec<IndexedSpan<T>>) -> Self where
S: Into<String>,
Creates a new SpannedString
manually.
It is not recommended to use this directly.
Instead, look for methods like Markdown::parse
.
pub fn single_span<S>(source: S, attr: T) -> Self where
S: Into<String>,
[src]
pub fn single_span<S>(source: S, attr: T) -> Self where
S: Into<String>,
Returns a new SpannedString with a single span.
pub fn append<S>(&mut self, other: S) where
S: Into<Self>,
[src]
pub fn append<S>(&mut self, other: S) where
S: Into<Self>,
Appends the given StyledString
to self
.
pub fn append_raw(&mut self, source: &str, spans: Vec<IndexedSpan<T>>)
[src]
pub fn append_raw(&mut self, source: &str, spans: Vec<IndexedSpan<T>>)
Appends content
and its corresponding spans to the end.
It is not recommended to use this directly;
instead, look at the append
method.
pub fn spans<'a>(&'a self) -> Vec<Span<'a, T>>
[src]
pub fn spans<'a>(&'a self) -> Vec<Span<'a, T>>
Gives access to the parsed styled spans.
pub fn spans_raw(&self) -> &[IndexedSpan<T>]
[src]
pub fn spans_raw(&self) -> &[IndexedSpan<T>]
Returns a reference to the indexed spans.
pub fn source(&self) -> &str
[src]
pub fn source(&self) -> &str
Returns a reference to the source string.
This is the non-parsed string.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true
if self is empty.
Trait Implementations
impl<T: Debug> Debug for SpannedString<T>
[src]
impl<T: Debug> Debug for SpannedString<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Clone> Clone for SpannedString<T>
[src]
impl<T: Clone> Clone for SpannedString<T>
fn clone(&self) -> SpannedString<T>
[src]
fn clone(&self) -> SpannedString<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq for SpannedString<T>
[src]
impl<T: PartialEq> PartialEq for SpannedString<T>
fn eq(&self, other: &SpannedString<T>) -> bool
[src]
fn eq(&self, other: &SpannedString<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &SpannedString<T>) -> bool
[src]
fn ne(&self, other: &SpannedString<T>) -> bool
This method tests for !=
.
impl<T: Eq> Eq for SpannedString<T>
[src]
impl<T: Eq> Eq for SpannedString<T>
impl<T> Default for SpannedString<T>
[src]
impl<T> Default for SpannedString<T>
impl<'a, T> SpannedText for &'a SpannedString<T>
[src]
impl<'a, T> SpannedText for &'a SpannedString<T>
type S = IndexedSpan<T>
Type of span returned by SpannedText::spans()
.
fn source(&self) -> &str
[src]
fn source(&self) -> &str
Returns the source text.
fn spans(&self) -> &[IndexedSpan<T>]
[src]
fn spans(&self) -> &[IndexedSpan<T>]
Returns the spans for this text.
fn as_ref<'a>(&'a self) -> SpannedTextRef<'a, Self>
[src]
fn as_ref<'a>(&'a self) -> SpannedTextRef<'a, Self>
Returns a SpannedText
by reference.
impl<S, T> From<S> for SpannedString<T> where
S: Into<String>,
T: Default,
[src]
impl<S, T> From<S> for SpannedString<T> where
S: Into<String>,
T: Default,
impl<'a, T> From<&'a SpannedString<T>> for SpannedStr<'a, T>
[src]
impl<'a, T> From<&'a SpannedString<T>> for SpannedStr<'a, T>
fn from(other: &'a SpannedString<T>) -> Self
[src]
fn from(other: &'a SpannedString<T>) -> Self
Performs the conversion.
Auto Trait Implementations
impl<T> Send for SpannedString<T> where
T: Send,
impl<T> Send for SpannedString<T> where
T: Send,
impl<T> Sync for SpannedString<T> where
T: Sync,
impl<T> Sync for SpannedString<T> where
T: Sync,