Struct spinoso_regexp::Options[][src]

pub struct Options { /* fields omitted */ }

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

impl Options[src]

#[must_use]pub const fn new() -> Self[src]

Constructs a new, default Options.

#[must_use]pub const fn with_ignore_case() -> Self[src]

An options instance that has only case insensitive mode enabled.

#[must_use]pub fn try_from_int(options: i64) -> Option<Self>[src]

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

#[must_use]pub const fn flags(self) -> Flags[src]

Convert an Options to its bit flag representation.

Alias for the corresponding Into<Flags> implementation.

#[must_use]pub const fn into_bits(self) -> u8[src]

Convert an Options to its bit representation.

Alias for the corresponding Into<u8> implementation.

pub const fn multiline(self) -> RegexpOption[src]

Whether these Options are configured for multiline mode.

pub const fn ignore_case(self) -> RegexpOption[src]

Whether these Options are configured for case-insensitive mode.

pub const fn extended(self) -> RegexpOption[src]

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

pub const fn is_literal(self) -> bool[src]

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 regrding capturing groups and report parse failures differently.

#[must_use]pub const fn as_display_modifier(self) -> &'static str[src]

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

See also Regexp#inspect.

#[must_use]pub const fn as_inline_modifier(self) -> &'static str[src]

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

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

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

Trait Implementations

impl Clone for Options[src]

impl Copy for Options[src]

impl Debug for Options[src]

impl Default for Options[src]

impl Display for Options[src]

impl Eq for Options[src]

impl From<&'_ [u8]> for Options[src]

impl From<&'_ str> for Options[src]

impl From<Flags> for Options[src]

impl From<Option<bool>> for Options[src]

impl From<Options> for Flags[src]

fn from(opts: Options) -> Self[src]

Convert an Options to its bit flag representation.

impl From<String> for Options[src]

impl From<Vec<u8, Global>> for Options[src]

impl From<i64> for Options[src]

fn from(flags: i64) -> Self[src]

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.

impl From<u8> for Options[src]

impl Hash for Options[src]

impl Ord for Options[src]

impl PartialEq<Options> for Options[src]

impl PartialOrd<Options> for Options[src]

impl StructuralEq for Options[src]

impl StructuralPartialEq for Options[src]

Auto Trait Implementations

impl RefUnwindSafe for Options

impl Send for Options

impl Sync for Options

impl Unpin for Options

impl UnwindSafe for Options

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.