pub enum Regex {
SingleCharacter {
value: u8,
},
Union {
options: Vec<Regex>,
},
Concat {
parts: Vec<Regex>,
},
Star {
repeated_pattern: Box<Regex>,
},
}
Expand description
A regular-expression pattern over raw bytes.
In practice, you won’t need to create instances of this type directly. Check out the Regex API and the high-level factory methods it offers.
Variants§
SingleCharacter
Only matches a single hardcoded byte.
Union
Matches each one of the specified patterns.
Concat
Matches a concatenation of the specified patterns.
Star
Matches a concatenation of zero or more repetitions of the specified pattern.
Implementations§
source§impl Regex
impl Regex
sourcepub fn single_char(value: char) -> Regex
pub fn single_char(value: char) -> Regex
Creates a pattern that only matches the specified character.
§Panics
If the character is not ASCII (cannot be represented by a single byte).
sourcepub fn union(options: Vec<Regex>) -> Regex
pub fn union(options: Vec<Regex>) -> Regex
Creates a pattern that matches each of the specified patterns.
sourcepub fn concat(parts: Vec<Regex>) -> Regex
pub fn concat(parts: Vec<Regex>) -> Regex
Creates a pattern that matches a concatenation of the specified patterns.
sourcepub fn star_from(repeated_pattern: Regex) -> Regex
pub fn star_from(repeated_pattern: Regex) -> Regex
Creates a pattern that matches zero or more repetitions of the specified pattern.
sourcepub fn plus_from(repeated_pattern: Regex) -> Regex
pub fn plus_from(repeated_pattern: Regex) -> Regex
Creates a pattern that matches one or more repetitions of the specified pattern.
sourcepub fn white_space() -> Regex
pub fn white_space() -> Regex
Creates a pattern that matches a single white-space character.
sourcepub fn constant_string(string: &str) -> Regex
pub fn constant_string(string: &str) -> Regex
Creates a pattern that matches a hard-coded sequence of characters.
sourcepub fn character_range(start: char, end: char) -> Regex
pub fn character_range(start: char, end: char) -> Regex
Creates a pattern that matches any single character between the specified couple of characters (inclusive).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Regex
impl RefUnwindSafe for Regex
impl Send for Regex
impl Sync for Regex
impl Unpin for Regex
impl UnwindSafe for Regex
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)