Skip to main content

OwnedHaystackable

Trait OwnedHaystackable 

Source
pub trait OwnedHaystackable<I: HaystackItem> {
    type Hay<'a>: HaystackOf<'a, I>
       where Self: 'a;

    // Required methods
    fn replace_range<'a>(
        &mut self,
        range: Range<usize>,
        with: <Self::Hay<'a> as HaystackIter<'a>>::Slice,
    )
       where Self: 'a;
    fn as_haystack<'a>(&'a self) -> Self::Hay<'a>;
    fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice;
    fn len(&self) -> usize;
}
Expand description

A trait representing an owned, mutable type that can be converted into a Haystack as required. This allows for Regex methods that replace matches or captures from the original Haystack.

It is also used as the return type of the closures take by a couple of Regex replace methods.

Required Associated Types§

Source

type Hay<'a>: HaystackOf<'a, I> where Self: 'a

Required Methods§

Source

fn replace_range<'a>( &mut self, range: Range<usize>, with: <Self::Hay<'a> as HaystackIter<'a>>::Slice, )
where Self: 'a,

Source

fn as_haystack<'a>(&'a self) -> Self::Hay<'a>

Source

fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice

Source

fn len(&self) -> usize

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl OwnedHaystackable<char> for String

Source§

type Hay<'a> = StrStack<'a>

Source§

fn replace_range<'a>( &mut self, range: Range<usize>, with: <Self::Hay<'a> as HaystackIter<'a>>::Slice, )
where Self: 'a,

Source§

fn as_haystack<'a>(&'a self) -> Self::Hay<'a>

Source§

fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice

Source§

fn len(&self) -> usize

Source§

impl OwnedHaystackable<char> for EcoString

Source§

type Hay<'a> = StrStack<'a>

Source§

fn replace_range<'a>( &mut self, range: Range<usize>, with: <Self::Hay<'a> as HaystackIter<'a>>::Slice, )
where Self: 'a,

Source§

fn as_haystack<'a>(&'a self) -> Self::Hay<'a>

Source§

fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice

Source§

fn len(&self) -> usize

Source§

impl OwnedHaystackable<u8> for Vec<u8>

Source§

type Hay<'a> = ByteStack<'a>

Source§

fn replace_range<'a>( &mut self, range: Range<usize>, with: <Self::Hay<'a> as HaystackIter<'a>>::Slice, )
where Self: 'a,

Source§

fn as_haystack<'a>(&'a self) -> Self::Hay<'a>

Source§

fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice

Source§

fn len(&self) -> usize

Source§

impl OwnedHaystackable<u8> for BString

Source§

type Hay<'a> = BStrStack<'a>

Source§

fn replace_range<'a>( &mut self, range: Range<usize>, with: <Self::Hay<'a> as HaystackIter<'a>>::Slice, )
where Self: 'a,

Source§

fn as_haystack<'a>(&'a self) -> Self::Hay<'a>

Source§

fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice

Source§

fn len(&self) -> usize

Source§

impl OwnedHaystackable<u8> for EcoVec<u8>

Source§

type Hay<'a> = ByteStack<'a>

Source§

fn replace_range<'a>( &mut self, range: Range<usize>, with: <Self::Hay<'a> as HaystackIter<'a>>::Slice, )
where Self: 'a,

Source§

fn as_haystack<'a>(&'a self) -> Self::Hay<'a>

Source§

fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice

Source§

fn len(&self) -> usize

Source§

impl<'s, B: Backend> OwnedHaystackable<char> for HipStr<'s, B>

Source§

type Hay<'a> = HipStrStack<'a, B> where Self: 'a

Source§

fn replace_range<'a>( &mut self, range: Range<usize>, with: <Self::Hay<'a> as HaystackIter<'a>>::Slice, )
where Self: 'a,

Source§

fn as_haystack<'a>(&'a self) -> Self::Hay<'a>

Source§

fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice

Source§

fn len(&self) -> usize

Source§

impl<'s, B: Backend> OwnedHaystackable<u8> for HipByt<'s, B>

Source§

type Hay<'a> = HipBytStack<'a, B> where Self: 'a

Source§

fn replace_range<'a>( &mut self, range: Range<usize>, with: <Self::Hay<'a> as HaystackIter<'a>>::Slice, )
where Self: 'a,

Source§

fn as_haystack<'a>(&'a self) -> Self::Hay<'a>

Source§

fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice

Source§

fn len(&self) -> usize

Implementors§