Struct onig::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> 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,

§

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>,

§

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>,

§

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.