Module haystack

Module haystack 

Source
Expand description

A collection of traits and structs that form the haystack system. Although usually implicit, these type may be needed on occasion for full type names etc.

Additionally, it is be possible to implement these traits for other types to allow matching different strings and other types, but not all of the traits will be required.

The main traits in this crate are chained together with associated items:

trait HaystackItem {}

trait HaystackSlice<'a> {
    type Item: HaystackItem;
}

trait HaystackIter<'a> {
    type Slice: HaystackSlice<'a>;
}

The primary types that will fill these roles are:

but byte-based types may also be used:

It needs to be noted that regardless of the haystack type being matched, the regular expression provided to the regex! macro needs to be valid UTF-8.

Modules§

arcstrarcstr
Extra haystack implementations for the arcstr crate.
bstrbstr
Extra haystack implementations for the bstr crate.
hipstrhipstr
Extra haystack implementations for the hipstr crate.

Structs§

ByteStack
A haystack type for matching against the u8s in a &[u8]. This type provides very straightforward indexing and iteration over the contained slice.
StrStack
A haystack type for matching against the chars in a &str. This type abstracts over the variable width scalars contained, to allow indexing without panics.

Traits§

Haystack
A trait used to interface the haystack types use when matching of capturing against a Regex, including tracking progression and slicing captures.
HaystackItem
A trait that represents an individual item that can be matched against a Regex. The primary (and only) two implementors are char and u8.
HaystackIter
The main underlying trait for Haystack types, HaystackIter should be implemented on new types that understand slicing and iterating over a haystack that can be sliced into instances of Self::Slice.
HaystackOf
This trait is exactly the same as Haystack, except that it simplifies bounds by requiring that Item = I.
HaystackSlice
A trait representing a slice of the underlying haystack for various Haystack types.
IntoHaystack
A trait that is responsible for converting a slice into a stateful Haystack, of type H. The primary intent of this trait is to allow users to avoid creating their own Haystack, instead passing a slice to methods on Regex.