artichoke_backend::core

Trait Regexp

Source
pub trait Regexp {
    type Error;

    // Required methods
    fn capture_group_globals(&self) -> Result<usize, Self::Error>;
    fn set_capture_group_globals(
        &mut self,
        count: usize,
    ) -> Result<(), Self::Error>;
    fn clear_regexp(&mut self) -> Result<(), Self::Error>;
}
Expand description

Track the state of Regexp special global variables and global interpreter state.

Required Associated Types§

Source

type Error

Concrete error type for errors encountered when manipulating Regexp state.

Required Methods§

Source

fn capture_group_globals(&self) -> Result<usize, Self::Error>

Retrieve the current number of set Regexp capture group global variables.

Regexp global variables like $1 and $7 are defined after certain Regexp matching methods for each capturing group in the regular expression.

Per the Ruby documentation:

$1, $2 and so on contain text matching first, second, etc capture group.

§Errors

If the Regexp state is inaccessible, an error is returned.

Source

fn set_capture_group_globals(&mut self, count: usize) -> Result<(), Self::Error>

Set the current number of set Regexp capture group global variables.

Regexp global variables like $1 and $7 are defined after certain Regexp matching methods for each capturing group in the regular expression.

Per the Ruby documentation:

$1, $2 and so on contain text matching first, second, etc capture group.

§Errors

If the Regexp state is inaccessible, an error is returned.

Source

fn clear_regexp(&mut self) -> Result<(), Self::Error>

Clear all Regexp state.

§Errors

If the Regexp state is inaccessible, an error is returned.

Implementors§

Source§

impl Regexp for Artichoke

Available on crate feature core-regexp only.