Spans

Struct Spans 

Source
pub struct Spans<T> { /* private fields */ }
Expand description

A string with various styles applied to the span. Styles do not not cascade. Only the most recent style applies to the current character.

Implementations§

Source§

impl<T> Spans<T>

Source

pub fn spans(&self) -> impl Iterator<Item = Span<'_, T>>
where T: Clone + Default,

Returns the spans of text contained in this object.

Trait Implementations§

Source§

impl<T> BoundedWidth for Spans<T>

Source§

fn bounded_width(&self) -> usize

Return the finite unicode width of an object Read more
Source§

impl<T: Clone> Clone for Spans<T>

Source§

fn clone(&self) -> Spans<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Spans<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for Spans<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, T: Paintable + Clone + Default> Display for Spans<T>

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default + Clone + PartialEq> Expandable for Spans<T>

Source§

fn expand(&self, capture: &Captures<'_>) -> Self

Returns self with the desired capture group expanded into self. For String, this is just a wrapper around Captures::expand. Read more
Source§

impl<T> From<&str> for Spans<T>
where T: Clone + Default + PartialEq,

Source§

fn from(other: &str) -> Spans<T>

Converts to this type from the input type.
Source§

impl<'a, T> FromIterator<Span<'a, T>> for Spans<T>
where T: Clone + PartialEq + 'a,

Source§

fn from_iter<I>(iter: I) -> Spans<T>
where I: IntoIterator<Item = Span<'a, T>>,

Creates a value from an iterator. Read more
Source§

impl<'a, T, U> FromIterator<U> for Spans<T>
where T: Clone + PartialEq + 'a, U: Borrow<Spans<T>> + 'a,

Source§

fn from_iter<I>(iter: I) -> Spans<T>
where I: IntoIterator<Item = U>,

Creates a value from an iterator. Read more
Source§

impl<T> HasWidth for Spans<T>

Source§

fn width(&self) -> Width

Return the unicode width of an object Read more
Source§

impl<T: PartialEq + Clone> Joinable<Span<'_, T>> for Spans<T>

Source§

type Output = Spans<T>

Source§

fn join(&self, other: &Span<'_, T>) -> Self::Output

Join an object to another object, returning an owned copy. Read more
Source§

impl<T: PartialEq + Clone> Joinable<Spans<T>> for Spans<T>

Source§

type Output = Spans<T>

Source§

fn join(&self, other: &Spans<T>) -> Self::Output

Join an object to another object, returning an owned copy. Read more
Source§

impl<T: PartialEq> PartialEq for Spans<T>

Source§

fn eq(&self, other: &Spans<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Pushable<&str> for Spans<T>

Source§

fn push(&mut self, other: &&str)

Pushes another text object onto this one. String implements this trivially. Read more
Source§

impl<'a, T: Clone + PartialEq> Pushable<Span<'a, T>> for Spans<T>

Source§

fn push(&mut self, other: &Span<'a, T>)

Pushes another text object onto this one. String implements this trivially. Read more
Source§

impl<T: Clone + PartialEq> Pushable<Spans<T>> for Spans<T>

Source§

fn push(&mut self, other: &Spans<T>)

Pushes another text object onto this one. String implements this trivially. Read more
Source§

impl<T> Pushable<str> for Spans<T>

Source§

fn push(&mut self, other: &str)

Pushes another text object onto this one. String implements this trivially. Read more
Source§

impl<T> RawText for Spans<T>

Source§

fn raw(&self) -> String

Return an owned copy of the raw contents of the text object. Read more
Source§

fn raw_ref<'a>(&self) -> &str

Return a reference ot the raw contents of the text object. Read more
Source§

impl<'a, T: Clone + PartialEq> Replaceable<&'a str> for Spans<T>

Source§

fn replace(&self, from: &str, replacer: &'a str) -> Self

Perform literal string replacement. Read more
Source§

fn replace_regex(&self, searcher: &Regex, replacer: &'a str) -> Self

Perform regex string replacement. Read more
Source§

impl<'a, T: Clone> Sliceable for Spans<T>

Source§

fn slice<R>(&self, range: R) -> Option<Self>
where R: RangeBounds<usize> + Clone,

Slice an underlying text object by bytes. Read more
Source§

impl<T: PartialEq> Eq for Spans<T>

Auto Trait Implementations§

§

impl<T> Freeze for Spans<T>

§

impl<T> RefUnwindSafe for Spans<T>
where T: RefUnwindSafe,

§

impl<T> Send for Spans<T>
where T: Send,

§

impl<T> Sync for Spans<T>
where T: Sync,

§

impl<T> Unpin for Spans<T>

§

impl<T> UnwindSafe for Spans<T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<S, O> Pushable<Option<O>> for S
where S: Pushable<O>,

Source§

fn push(&mut self, other: &Option<O>)

Pushes another text object onto this one. String implements this trivially. Read more
Source§

impl<'a, T> Replaceable<&'a T> for T

Source§

fn replace(&self, from: &str, replacer: &'a T) -> T

Perform literal string replacement. Read more
Source§

fn replace_regex(&self, searcher: &Regex, replacer: &'a T) -> T

Perform regex string replacement. Read more
Source§

impl<'a, T> Splitable<'a, &'a str> for T
where T: Sliceable + RawText,

Source§

fn split( &'a self, pattern: &'a str, ) -> Box<dyn Iterator<Item = Split<T, T>> + 'a>

Split a text object on the given pattern. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WidthSliceable for T
where T: RawText + Sliceable,

Source§

type Output = T

Source§

fn slice_width<R>(&self, range: R) -> Option<<T as WidthSliceable>::Output>
where R: RangeBounds<usize>,

Slice an object by width rather than by bytes. Read more
Source§

impl<'a, T> Truncateable for T