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>,
replacement: <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;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Required Associated Types§
type Hay<'a>: HaystackOf<'a, I> where Self: 'a
Required Methods§
Sourcefn replace_range<'a>(
&mut self,
range: Range<usize>,
replacement: <Self::Hay<'a> as HaystackIter<'a>>::Slice,
)where
Self: 'a,
fn replace_range<'a>(
&mut self,
range: Range<usize>,
replacement: <Self::Hay<'a> as HaystackIter<'a>>::Slice,
)where
Self: 'a,
Replaces the substring at the position indicated by range with the replacement
HaystackSlice.
Sourcefn as_haystack<'a>(&'a self) -> Self::Hay<'a>
fn as_haystack<'a>(&'a self) -> Self::Hay<'a>
Creates a temporary Haystack out of the underlying slice. This should usually be done by
borrowing (or cloning if reference counted) and calling IntoHaystack::into_haystack.
Sourcefn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice
fn as_slice<'a>(&'a self) -> <Self::Hay<'a> as HaystackIter<'a>>::Slice
Borrows the underlying HaystackSlice without creating a haystack. Used for slicing
substrings. Note that HaystackSlice is inherently borrowed and probably be implemented for
a reference.
Provided Methods§
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.