Struct NoExpand
pub struct NoExpand<'s>(pub &'s str);
A helper type for forcing literal string replacement.
It can be used with routines like Regex::replace and
Regex::replace_all to do a literal string replacement without expanding
$name to their corresponding capture groups. This can be both convenient
(to avoid escaping $, for example) and faster (since capture groups
don't need to be found).
's is the lifetime of the literal string to use.
Example
use ;
let re = new.unwrap;
let result = re.replace;
assert_eq!;
Fields
0: &'s str
Trait Implementations
impl<'s> Clone for NoExpand<'s>
fn clone(&self) -> NoExpand<'s>
impl<'s> Debug for NoExpand<'s>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<'s> Replacer for NoExpand<'s>
fn replace_append(&mut self, &Captures<'_>, dst: &mut String)fn no_expansion(&mut self) -> Option<Cow<'_, str>>
Auto Trait Implementations
impl<'s> Freeze for NoExpand<'s>
impl<'s> RefUnwindSafe for NoExpand<'s>
impl<'s> Send for NoExpand<'s>
impl<'s> Sync for NoExpand<'s>
impl<'s> Unpin for NoExpand<'s>
impl<'s> UnsafeUnpin for NoExpand<'s>
impl<'s> UnwindSafe for NoExpand<'s>
Blanket Implementations
impl<T> Any for NoExpand<'s>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for NoExpand<'s>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for NoExpand<'s>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for NoExpand<'s>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for NoExpand<'s>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for NoExpand<'s>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for NoExpand<'s>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for NoExpand<'s>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for NoExpand<'s>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>