rust/hg-core/src/re2/mod.rs
changeset 44305 d8d4fa9a7f18
equal deleted inserted replaced
44304:2fe89bec8011 44305:d8d4fa9a7f18
       
     1 /// re2 module
       
     2 ///
       
     3 /// The Python implementation of Mercurial uses the Re2 regex engine when
       
     4 /// possible and if the bindings are installed, falling back to Python's `re`
       
     5 /// in case of unsupported syntax (Re2 is a non-backtracking engine).
       
     6 ///
       
     7 /// Using it from Rust is not ideal. We need C++ bindings, a C++ compiler,
       
     8 /// Re2 needs to be installed... why not just use the `regex` crate?
       
     9 ///
       
    10 /// Using Re2 from the Rust implementation guarantees backwards compatibility.
       
    11 /// We know it will work out of the box without needing to figure out the
       
    12 /// subtle differences in syntax. For example, `regex` currently does not
       
    13 /// support empty alternations (regex like `a||b`) which happens more often
       
    14 /// than we might think. Old benchmarks also showed worse performance from
       
    15 /// regex than with Re2, but the methodology and results were lost, so take
       
    16 /// this with a grain of salt.
       
    17 ///
       
    18 /// The idea is to use Re2 for now as a temporary phase and then investigate
       
    19 /// how much work would be needed to use `regex`.
       
    20 mod re2;
       
    21 pub use re2::Re2;