ct_regex/
haystack.rs

1//! A collection of traits and structs that form the haystack system. Although usually implicit,
2//! these type may be needed on occasion for full type names etc.
3//!
4//! Additionally, it is be possible to implement these traits for other types to allow matching
5//! different strings and other types, but not all of the traits will be required.
6//!
7//! The main traits in this crate are chained together with associated items:
8//! ```
9//! trait HaystackItem {}
10//!
11//! trait HaystackSlice<'a> {
12//!     type Item: HaystackItem;
13//! }
14//!
15//! trait HaystackIter<'a> {
16//!     type Slice: HaystackSlice<'a>;
17//! }
18//! ```
19//!
20//! The primary types that will fill these roles are:
21//!
22//! - `Item`: [`char`]
23//! - `Slice<'a>`: [`&'a str`](str)
24//! - `HaystackIter<'a>`: [`StrStack<'a>`]
25//!
26//! but byte-based types may also be used:
27//!
28//! - `Item`: [`u8`]
29//! - `Slice<'a>`: [`&'a [u8]`](slice)
30//! - `HaystackIter<'a>`: [`ByteStack<'a>`]
31//!
32//! It needs to be noted that regardless of the haystack type being matched, the regular expression
33//! provided to the `regex!` macro needs to be valid UTF-8.
34
35pub use ct_regex_internal::haystack::{ByteStack, Haystack, HaystackItem, HaystackIter, HaystackSlice, HaystackOf, IntoHaystack, StrStack};
36
37#[cfg(any(doc, feature = "arcstr"))]
38#[doc(cfg(feature = "arcstr"))]
39pub use ct_regex_internal::haystack::arcstr;
40
41#[cfg(any(doc, feature = "bstr"))]
42#[doc(cfg(feature = "bstr"))]
43pub use ct_regex_internal::haystack::bstr;
44
45#[cfg(any(doc, feature = "hipstr"))]
46#[doc(cfg(feature = "hipstr"))]
47pub use ct_regex_internal::haystack::hipstr;