Struct spinoso_regexp::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
impl Options
sourcepub const fn with_ignore_case() -> Self
pub const fn with_ignore_case() -> Self
An options instance that has only case insensitive mode enabled.
sourcepub fn try_from_int(options: i64) -> Option<Self>
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>
.
sourcepub fn flags(self) -> Flags
pub fn flags(self) -> Flags
Convert an Options
to its bit flag representation.
Alias for the corresponding Into<Flags>
implementation.
sourcepub const fn into_bits(self) -> u8
pub const fn into_bits(self) -> u8
Convert an Options
to its bit representation.
Alias for the corresponding Into<u8>
implementation.
sourcepub const fn multiline(self) -> RegexpOption
pub const fn multiline(self) -> RegexpOption
Whether these Options
are configured for multiline mode.
sourcepub const fn ignore_case(self) -> RegexpOption
pub const fn ignore_case(self) -> RegexpOption
Whether these Options
are configured for case-insensitive mode.
sourcepub const fn extended(self) -> RegexpOption
pub const fn extended(self) -> RegexpOption
Whether these Options
are configured for extended mode with
insignificant whitespace.
sourcepub const fn is_literal(self) -> bool
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.
sourcepub const fn as_display_modifier(self) -> &'static str
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
.
sourcepub const fn as_inline_modifier(self) -> &'static str
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
.
Trait Implementations§
source§impl From<Options> for RegexOptions
impl From<Options> for RegexOptions
source§impl Ord for Options
impl Ord for Options
source§impl PartialEq for Options
impl PartialEq for Options
source§impl PartialOrd for Options
impl PartialOrd for Options
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more