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
sourceimpl Config
impl Config
sourcepub const fn new() -> Config
pub const fn new() -> Config
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, Global>,
options: Options
) -> Config
pub const fn with_pattern_and_options(
pattern: Vec<u8, Global>,
options: Options
) -> Config
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]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn pattern(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [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
sourceimpl Ord for Config
impl Ord for Config
sourceimpl PartialOrd<Config> for Config
impl PartialOrd<Config> for Config
sourcefn partial_cmp(&self, other: &Config) -> Option<Ordering>
fn partial_cmp(&self, other: &Config) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Config
impl StructuralEq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more