Crate hitori

Source
Expand description

Hitori is generic compile-time regular expressions library. It works by creating series of if-statements and for-loops for each expression.

See code samples along with the traits, impls and structs they expand to in examples.

§Limitations

Pattern matching is step-by-step. It is impossible to to detach last element of a repetition. For example, using regex one can rewrite a+ as a*a and it would still match any sequence of as longer than zero. With hitori, however, a* would consume all the as, and the expression won’t match.

Step-by step pattern matching also leads to diminished performance when matching large texts with an expression that contains repetitions of characters frequent in the text.

§Crate features

  • alloc (enabled by default) – string replace functions and blanket implementations of hitori traits for boxes using alloc crate.
  • macros (enabled by default)impl_expr_mut and impl_expr macros.
  • find-hitori – finds hitori package to be used in macros even if it has been renamed in Cargo.toml. macros feature is required.

Modules§

string
Items specific to ExprMut<usize, char>

Structs§

Match
Single ExprMut match

Traits§

Expr
Expression with an immutable state
ExprMut
Expression with a mutable state

Functions§

find
Finds the first subsequence of characters that is matched by ExprMut.
starts_with
Checks if an Iterator starts with ExprMut-matched characters.

Attribute Macros§

impl_exprmacros
Implements Expr and ExprMut for the type.
impl_expr_mutmacros
Implements ExprMut for the type.