RegexEngine

Trait RegexEngine 

Source
pub trait RegexEngine: Sized {
    type CompileError: Error + Send + Sync + 'static;

    // Required method
    fn compile(re: &str) -> Result<Self, Self::CompileError>;
}
Expand description

A RegexEngine is an underlying regular expression engine that can be used to match and extract text as part of a structural regular expression.

The interface provided by this trait is intended for use by Structex as an internal implementation detail and is likely not particularly useful outside of this crate. Implementors of this trait should pay particular attention to the requirements around compilation in order for the resulting regex expressions to be compatible with this crate.

Required Associated Types§

Source

type CompileError: Error + Send + Sync + 'static

Error type that is returned by the RegexEngine::compile method when compilation of a given regular expression fails. This will be wrapped into an Error when returned from Structex::compile or StructexBuilder::build.

Required Methods§

Source

fn compile(re: &str) -> Result<Self, Self::CompileError>

Attempt to compile the given regular expression for use inside of a Structex.

§Multi-line matching

Almost all use cases for structural regular expressions involve matching patterns that span multiple lines. As such, any underlying regular expression engine used with Structex must support multi-line patterns in order to provide the expected semantics of each of the different operators that build upon it.

See here for information on how this is implemented in the regex crate for reference.

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.

Implementations on Foreign Types§

Source§

impl RegexEngine for Regex

Implementors§