pub trait HaystackSlice<'a>:
Sized
+ Debug
+ Clone
+ ToOwned {
type Item: HaystackItem;
// Required methods
fn slice_with(&self, range: Range<usize>) -> Self;
fn as_bytes(&self) -> &[u8] ⓘ;
}Expand description
A trait representing a slice of the underlying haystack for various Haystack types.
The implementer of this trait is usually but not always, the only implementer of
IntoHaystack for a haystack type.
It should be noted that this trait is often implemented of a reference to the type in question,
e.g. &str or &[u8] rather than str or [u8] themselves, so that the implementing type can
be cloned as required.
Required Associated Types§
Sourcetype Item: HaystackItem
type Item: HaystackItem
The HaystackItem contained within this slice.
Required Methods§
Sourcefn slice_with(&self, range: Range<usize>) -> Self
fn slice_with(&self, range: Range<usize>) -> Self
Slices the underlying slice with the provided (half-open) range, used for retrieving
values of capture groups.
fn as_bytes(&self) -> &[u8] ⓘ
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.