spinoso_regexp

Struct Options

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

Configuration options for Ruby Regexps.

Options can be supplied either as an Integer object to Regexp::new or inline in Regexp literals like /artichoke/i.

Implementations§

Source§

impl Options

Source

pub const fn new() -> Self

Constructs a new, default Options.

Source

pub const fn with_ignore_case() -> Self

An options instance that has only case insensitive mode enabled.

Source

pub fn try_from_int(options: i64) -> Option<Self>

Try to parse an Options from a full-width i64.

If options cannot be converted losslessly to a u8, this function returns None. See From<u8>.

For a conversion from i64 that truncates the given options to u8, see From<i64>.

Source

pub fn flags(self) -> Flags

Convert an Options to its bit flag representation.

Alias for the corresponding Into<Flags> implementation.

Source

pub const fn into_bits(self) -> u8

Convert an Options to its bit representation.

Alias for the corresponding Into<u8> implementation.

Source

pub const fn multiline(self) -> RegexpOption

Whether these Options are configured for multiline mode.

Source

pub const fn ignore_case(self) -> RegexpOption

Whether these Options are configured for case-insensitive mode.

Source

pub const fn extended(self) -> RegexpOption

Whether these Options are configured for extended mode with insignificant whitespace.

Source

pub const fn is_literal(self) -> bool

Whether the Regexp was parsed as a literal, e.g. '/artichoke/i.

This enables Ruby parsers to inject whether a Regexp is a literal to the core library. Literal Regexps have some special behavior regarding capturing groups and report parse failures differently.

Source

pub const fn as_display_modifier(self) -> &'static str

Serialize the option flags to a string suitable for a Regexp display or debug implementation.

See also Regexp#inspect.

Source

pub const fn as_inline_modifier(self) -> &'static str

Serialize the option flags to a string suitable for including in a raw pattern for configuring an underlying Regexp.

Source

pub fn set(&mut self, other: Flags, value: bool)

Inserts or removes the specified flags depending on the passed value.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

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 Options

Source§

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

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

impl Default for Options

Source§

fn default() -> Options

Returns the “default value” for a type. Read more
Source§

impl Display for Options

Source§

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

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

impl From<&[u8]> for Options

Source§

fn from(options: &[u8]) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for Options

Source§

fn from(options: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Flags> for Options

Source§

fn from(flags: Flags) -> Self

Converts to this type from the input type.
Source§

impl From<Option<bool>> for Options

Source§

fn from(options: Option<bool>) -> Self

Converts to this type from the input type.
Source§

impl From<Options> for Flags

Source§

fn from(opts: Options) -> Self

Convert an Options to its bit flag representation.

Source§

impl From<Options> for RegexOptions

Source§

fn from(opts: Options) -> Self

Converts to this type from the input type.
Source§

impl From<Options> for i64

Source§

fn from(opts: Options) -> Self

Convert an Options to its widened bit representation.

Source§

impl From<Options> for u8

Source§

fn from(opts: Options) -> Self

Convert an Options to its bit representation.

Source§

impl From<String> for Options

Source§

fn from(options: String) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Options

Source§

fn from(options: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Options

Source§

fn from(flags: i64) -> Self

Truncate the given i64 to one byte and generate flags.

See From<u8>. For a conversion that fails if the given i64 is larger than u8::MAX, see try_from_int.

Source§

impl From<u8> for Options

Source§

fn from(flags: u8) -> Self

Converts to this type from the input type.
Source§

impl Hash for Options

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Options

Source§

fn cmp(&self, other: &Options) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Options

Source§

fn eq(&self, other: &Options) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Options

Source§

fn partial_cmp(&self, other: &Options) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Options

Source§

impl Eq for Options

Source§

impl StructuralPartialEq for Options

Auto Trait Implementations§

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 u8)

🔬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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.