[−][src]Struct metadata_filter::rules::FilterRule
Represents a regex replacement rule with a pattern and replacement text.
Implementations
impl FilterRule
[src]
pub fn new(pattern: &str, replacement: &str) -> Result<Self, Box<dyn Error>>
[src]
Create a new filter rule with a pattern and a replacement text.
The pattern follows the syntax from the regex
crate.
Returns an error if the regex could not be compiled.
pub fn apply<'t>(&self, text: &'t str) -> Cow<'t, str>
[src]
Apply the filter rule. Returns Cow::Owned if a replacement was done, or Cow::Borrowed (referencing the original text) if nothing was changed.
Trait Implementations
impl Clone for FilterRule
[src]
pub fn clone(&self) -> FilterRule
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FilterRule
[src]
Auto Trait Implementations
impl !RefUnwindSafe for FilterRule
impl Send for FilterRule
impl Sync for FilterRule
impl Unpin for FilterRule
impl UnwindSafe for FilterRule
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,