pub struct Injector<I>{ /* private fields */ }
Expand description
An injector that can be used to push items of type I
into the fuzzy matcher.
This is a wrapper around the Injector
type from the Nucleo
fuzzy matcher.
The push
method takes an item of type I
and a closure that produces the
string to match against based on the item.
Implementations§
Source§impl<I> Injector<I>
impl<I> Injector<I>
pub fn new(inner: Injector<I>) -> Self
Sourcepub fn push<F>(&self, item: I, f: F)
pub fn push<F>(&self, item: I, f: F)
Push an item into the fuzzy matcher.
The closure f
should produce the string to match against based on the
item.
§Example
use television_fuzzy::matcher::{config::Config, Matcher};
let config = Config::default();
let matcher = Matcher::new(config);
let injector = matcher.injector();
injector.push(
("some string", 3, "some other string"),
// Say we want to match against the third element of the tuple
|s, cols| cols[0] = s.2.into()
);
Trait Implementations§
Auto Trait Implementations§
impl<I> Freeze for Injector<I>
impl<I> !RefUnwindSafe for Injector<I>
impl<I> Send for Injector<I>
impl<I> Sync for Injector<I>
impl<I> Unpin for Injector<I>
impl<I> !UnwindSafe for Injector<I>
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more