[][src]Struct cursive::utils::span::SpannedString

pub struct SpannedString<T> { /* fields omitted */ }

A string with associated spans.

Each span has an associated attribute T.

Implementations

impl SpannedString<Style>[src]

pub fn plain<S>(content: S) -> SpannedString<Style> where
    S: Into<String>, 
[src]

Returns a plain StyledString without any style.

You got no style, Dutch. You know that.

pub fn styled<S, T>(content: S, style: T) -> SpannedString<Style> where
    S: Into<String>,
    T: Into<Style>, 
[src]

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]

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]

Appends text to self, using style.

impl SpannedString<()>[src]

pub fn plain<S>(content: S) -> SpannedString<()> where
    S: Into<String>, 
[src]

Returns a simple spanned string without any attribute.

impl<T> SpannedString<T>[src]

pub fn new() -> SpannedString<T>[src]

Returns an empty SpannedString.

pub fn with_spans<S>(source: S, spans: Vec<IndexedSpan<T>>) -> SpannedString<T> where
    S: Into<String>, 
[src]

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) -> SpannedString<T> where
    S: Into<String>, 
[src]

Returns a new SpannedString with a single span.

pub fn append<S>(&mut self, other: S) where
    S: Into<SpannedString<T>>, 
[src]

Appends the given StyledString to self.

pub fn append_raw(&mut self, source: &str, spans: Vec<IndexedSpan<T>>)[src]

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(&self) -> impl Iterator<Item = Span<T>>[src]

Gives access to the parsed styled spans.

pub fn spans_raw(&self) -> &[IndexedSpan<T>][src]

Returns a reference to the indexed spans.

pub fn source(&self) -> &str[src]

Returns a reference to the source string.

This is the non-parsed string.

pub fn is_empty(&self) -> bool[src]

Returns true if self is empty.

pub fn width(&self) -> usize[src]

Returns the width taken by this string.

This is the sum of the width of each span.

Trait Implementations

impl<T> Clone for SpannedString<T> where
    T: Clone
[src]

impl<T> Debug for SpannedString<T> where
    T: Debug
[src]

impl<T> Default for SpannedString<T>[src]

impl<T> Eq for SpannedString<T> where
    T: Eq
[src]

impl<'a, T> From<&'a SpannedString<T>> for SpannedStr<'a, T>[src]

impl<S, T> From<S> for SpannedString<T> where
    S: Into<String>,
    T: Default
[src]

impl<T> PartialEq<SpannedString<T>> for SpannedString<T> where
    T: PartialEq<T>, 
[src]

impl<'a, T> SpannedText for &'a SpannedString<T>[src]

type S = IndexedSpan<T>

Type of span returned by SpannedText::spans().

impl<T> StructuralEq for SpannedString<T>[src]

impl<T> StructuralPartialEq for SpannedString<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for SpannedString<T> where
    T: RefUnwindSafe

impl<T> Send for SpannedString<T> where
    T: Send

impl<T> Sync for SpannedString<T> where
    T: Sync

impl<T> Unpin for SpannedString<T> where
    T: Unpin

impl<T> UnwindSafe for SpannedString<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> With for T[src]