pub struct Config { /* private fields */ }
Expand description
A Config
represents the parsed, expanded, and normalized pattern and
options used to initialize a Regexp
.
A Config
is derived from a Source
.
When a Regexp
is cloned, it is cloned from its compiled Config
.
Implementations§
Source§impl Config
impl Config
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Construct a new, empty Config
.
§Examples
use spinoso_regexp::Config;
const CONFIG: Config = Config::new();
assert!(CONFIG.pattern().is_empty());
assert!(CONFIG.options().as_display_modifier().is_empty());
Sourcepub const fn with_pattern_and_options(
pattern: Vec<u8>,
options: Options,
) -> Self
pub const fn with_pattern_and_options( pattern: Vec<u8>, options: Options, ) -> Self
Construct a new Config
with the given pattern and Options
.
§Examples
use spinoso_regexp::{Config, Options};
let config = Config::with_pattern_and_options(
b"Artichoke( Ruby)?".to_vec(),
Options::with_ignore_case(),
);
assert_eq!(config.pattern(), b"Artichoke( Ruby)?");
assert_eq!(config.options().as_display_modifier(), "i");
Sourcepub fn pattern(&self) -> &[u8] ⓘ
pub fn pattern(&self) -> &[u8] ⓘ
Extracts a slice containing the entire pattern.
§Examples
use spinoso_regexp::{Config, Options};
let config = Config::with_pattern_and_options(
b"Artichoke( Ruby)?".to_vec(),
Options::with_ignore_case(),
);
assert_eq!(config.pattern(), b"Artichoke( Ruby)?");
Trait Implementations§
Source§impl Ord for Config
impl Ord for Config
Source§impl PartialOrd for Config
impl PartialOrd for Config
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more