pub trait DiffableStrRef {
    type Output: DiffableStr + ?Sized;

    // Required method
    fn as_diffable_str(&self) -> &Self::Output;
}
Expand description

Reference to a DiffableStr.

This type exists because while the library only really provides ways to work with &str and &[u8] there are types that deref into those string slices such as String and Vec<u8>.

This trait is used in the library whenever it’s nice to be able to pass strings of different types in.

Requires the text feature.

Required Associated Types§

source

type Output: DiffableStr + ?Sized

The type of the resolved DiffableStr.

Required Methods§

source

fn as_diffable_str(&self) -> &Self::Output

Resolves the reference.

Implementations on Foreign Types§

source§

impl DiffableStrRef for String

source§

impl DiffableStrRef for Vec<u8>

§

type Output = [u8]

source§

fn as_diffable_str(&self) -> &[u8]

source§

impl<'a, T: DiffableStr + ?Sized> DiffableStrRef for Cow<'a, T>

§

type Output = T

source§

fn as_diffable_str(&self) -> &T

Implementors§