Regex

Struct Regex 

Source
pub struct Regex { /* private fields */ }

Implementations§

Source§

impl Regex

Source

pub fn compile(pattern: &str, flag: Flag) -> Result<Regex, ComplieError>

Source

pub fn byte_code(&self) -> Vec<u8>

Source

pub fn capture_count(&self) -> usize

Source

pub const fn from_static( byte_code: &'static [u8], capture_count: usize, ) -> Regex

Source

pub fn test(&self, s: &str) -> bool

Source

pub fn try_match<'a>(&self, s: &'a str) -> Result<Vec<&'a str>, ExecError>

Source

pub fn try_matchn<'a>( &self, s: &'a str, n: usize, ) -> Result<Vec<Vec<&'a str>>, ExecError>

Source

pub fn try_match_all<'a>( &self, s: &'a str, ) -> Result<Vec<Vec<&'a str>>, ExecError>

Source

pub fn try_replace<'a, F>(&self, s: &'a str, f: F) -> Result<String, ExecError>
where F: Fn(&[&'a str]) -> String,

Source

pub fn try_replace_all<'a, F>( &self, s: &'a str, f: F, ) -> Result<String, ExecError>
where F: Fn(&[&'a str]) -> String,

Source

pub fn try_replacen<'a, F>( &self, s: &'a str, f: F, n: usize, ) -> Result<String, ExecError>
where F: Fn(&[&'a str]) -> String,

Trait Implementations§

Source§

impl Debug for Regex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.