#[repr(u32)]pub enum Encoding {
Utf8 = 1,
Latin1 = 2,
}
Expand description
Encoding of text inputs.
When Self::Utf8
is selected (the default), re2
will happily accept
str
patterns and inputs:
use re2::{*, options::*};
let r: RE2 = "asdf".parse()?;
assert_eq!(Encoding::Utf8, r.options().encoding);
assert!(r.full_match("asdf"));
However, re2
will also accept Latin-1 encoded text. Each string method has
a *_view
-suffixed version which accepts a StringView
, which can
represent a slice of arbitrary bytes:
use re2::{*, options::*};
let o: Options = CannedOptions::Latin1.into();
let r = RE2::compile("asdf", o)?;
assert_eq!(Encoding::Latin1, r.options().encoding);
assert!(r.full_match("asdf"));
Variants§
Trait Implementations§
Source§impl Ord for Encoding
impl Ord for Encoding
Source§impl PartialOrd for Encoding
impl PartialOrd for Encoding
Source§impl TryFromPrimitive for Encoding
impl TryFromPrimitive for Encoding
impl Copy for Encoding
impl Eq for Encoding
impl StructuralPartialEq for Encoding
Auto Trait Implementations§
impl Freeze for Encoding
impl RefUnwindSafe for Encoding
impl Send for Encoding
impl Sync for Encoding
impl Unpin for Encoding
impl UnwindSafe for Encoding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.