Span

Struct Span 

Source
pub struct Span<'a, T: Clone> { /* private fields */ }
Expand description

A span of text having a single style.

Implementations§

Source§

impl<'a, T: Clone> Span<'a, T>

Source

pub fn style(&self) -> &Cow<'a, T>

Source

pub fn new(style: Cow<'a, T>, content: Cow<'a, str>) -> Span<'a, T>

Source

pub fn borrowed(style: &'a T, content: &'a str) -> Span<'a, T>

Trait Implementations§

Source§

impl<'a, T: Clone> BoundedWidth for Span<'a, T>

Source§

fn bounded_width(&self) -> usize

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

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

Source§

fn clone(&self) -> Span<'a, 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<'a, T: Debug + Clone> Debug for Span<'a, T>

Source§

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

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

impl<'a, T: Default + Clone> Default for Span<'a, T>

Source§

fn default() -> Span<'a, T>

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

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

Source§

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

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

impl<'a, T: Clone> Expandable for Span<'a, T>

Source§

fn expand(&self, capture: &Captures<'_>) -> Span<'a, T>

Returns self with the desired capture group expanded into self. For String, this is just a wrapper around Captures::expand. Read more
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: Clone> HasWidth for Span<'a, 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<'a, T: Clone + Default + PartialEq> Joinable<Span<'a, T>> for Span<'a, 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<'a, T: PartialEq + Clone> PartialEq for Span<'a, T>

Source§

fn eq(&self, other: &Span<'a, 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<'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<'a, T: Clone> Pushable<str> for Span<'a, 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> RawText for Span<'a, T>

Source§

fn raw(&self) -> String

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

fn raw_ref(&self) -> &str

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

impl<'a, T: Clone> Sliceable for Span<'a, 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<'a, T: Clone> StructuralPartialEq for Span<'a, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for Span<'a, T>
where T: Freeze,

§

impl<'a, T> RefUnwindSafe for Span<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Span<'a, T>
where T: Send + Sync,

§

impl<'a, T> Sync for Span<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Span<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for Span<'a, T>

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> 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