Skip to main content

SpannedStrExt

Trait SpannedStrExt 

Source
pub trait SpannedStrExt<T>: Clone {
    // Required methods
    fn char_len(&self) -> usize;
    fn chars(&self) -> Chars<'_>;
    fn to_spanned_string(&self) -> SpannedString<T>;
    fn as_spanned_str(&self) -> SpannedStr<'_, T>;
}
Expand description

Extension trait for SpannedString and SpannedStr

These methods might be useful when working with StyledStrings

Required Methods§

Source

fn char_len(&self) -> usize

The amount of UTF-8 characters in the source string

Source

fn chars(&self) -> Chars<'_>

Iterate over the characters in the source string

Disclaimer: some special characters are actually multiple characters (like accented letters)

Source

fn to_spanned_string(&self) -> SpannedString<T>

Convert the SpannedStr back to a SpannedString

Source

fn as_spanned_str(&self) -> SpannedStr<'_, T>

Creates a SpannedStr reference from a SpannedString

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, T: Clone> SpannedStrExt<T> for SpannedStr<'a, T>

Source§

impl<T: Clone> SpannedStrExt<T> for SpannedString<T>

Implementors§