onig

Struct Syntax

Source
pub struct Syntax { /* private fields */ }
Expand description

Onig Syntax Wrapper

Each syntax dfines a flavour of regex syntax. This type allows interaction with the built-in syntaxes through the static accessor functions (Syntax::emacs(), Syntax::default() etc.) and the creation of custom syntaxes.

For a demonstration of creating a custom syntax see examples/syntax.rs in the main onig crate.

Implementations§

Source§

impl Syntax

Source

pub fn python() -> &'static Syntax

Python syntax

Source

pub fn asis() -> &'static Syntax

Plain text syntax

Source

pub fn posix_basic() -> &'static Syntax

POSIX Basic RE syntax

Source

pub fn posix_extended() -> &'static Syntax

POSIX Extended RE syntax

Source

pub fn emacs() -> &'static Syntax

Emacs syntax

Source

pub fn grep() -> &'static Syntax

Grep syntax

Source

pub fn gnu_regex() -> &'static Syntax

GNU regex syntax

Source

pub fn java() -> &'static Syntax

Java (Sun java.util.regex) syntax

Source

pub fn perl() -> &'static Syntax

Perl syntax

Source

pub fn perl_ng() -> &'static Syntax

Perl + named group syntax

Source

pub fn ruby() -> &'static Syntax

Ruby syntax

Source

pub fn oniguruma() -> &'static Syntax

Oniguruma Syntax

Source

pub fn default() -> &'static Syntax

Default syntax (Ruby syntax)

Source

pub fn operators(&self) -> SyntaxOperator

Retrieve the operators for this syntax

Source

pub fn set_operators(&mut self, operators: SyntaxOperator)

Replace the operators for this syntax

Source

pub fn enable_operators(&mut self, operators: SyntaxOperator)

Enable Operators for this Syntax

Updates the operators for this syntax to enable the chosen ones.

Source

pub fn disable_operators(&mut self, operators: SyntaxOperator)

Disable Operators for this Syntax

Updates the operators for this syntax to remove the specified operators.

Source

pub fn behavior(&self) -> SyntaxBehavior

Retrieves the syntax behaviours

Source

pub fn set_behavior(&mut self, behavior: SyntaxBehavior)

Overwrite the syntax behaviour for this syntax.

Source

pub fn enable_behavior(&mut self, behavior: SyntaxBehavior)

Enable a given behaviour for this syntax

Source

pub fn disable_behavior(&mut self, behavior: SyntaxBehavior)

Disable a given behaviour for this syntax

Source

pub fn options(&self) -> RegexOptions

Retireve the syntax options for this syntax

Source

pub fn set_options(&mut self, options: RegexOptions)

Replace the syntax options for this syntax

Source

pub fn set_meta_char(&mut self, what: MetaCharType, meta: MetaChar)

Set a given meta character’s state

Arguments:

  • what: The meta character to update
  • meta: The value to set the meta character to

Trait Implementations§

Source§

impl Clone for Syntax

Source§

fn clone(&self) -> Syntax

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Syntax

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Copy for Syntax

Auto Trait Implementations§

§

impl Freeze for Syntax

§

impl RefUnwindSafe for Syntax

§

impl Send for Syntax

§

impl Sync for Syntax

§

impl Unpin for Syntax

§

impl UnwindSafe for Syntax

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.