pub trait Matcher<IN>: Send
where IN: ?Sized,
{ // Required methods fn matches(&mut self, input: &IN, ctx: &mut ExecutionContext) -> bool; fn fmt(&self, f: &mut Formatter<'_>) -> Result; }
Expand description

The core trait. Defines how an input value should be turned into an output value. This allows for a flexible pattern of composition where two or more matchers are chained together to form a readable and flexible manipulation.

Required Methods§

source

fn matches(&mut self, input: &IN, ctx: &mut ExecutionContext) -> bool

Map an input to output.

source

fn fmt(&self, f: &mut Formatter<'_>) -> Result

formatted name of the mapper. This is used for debugging purposes and should typically look like a fmt::Debug representation.

Implementations on Foreign Types§

source§

impl<IN> Matcher<IN> for &str
where IN: AsRef<[u8]> + ?Sized,

A &str is an implicit Eq mapper.

source§

fn matches(&mut self, input: &IN, _ctx: &mut ExecutionContext) -> bool

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

source§

impl<IN> Matcher<IN> for &[u8]
where IN: AsRef<[u8]> + ?Sized,

A &u8 is an implicit Eq mapper.

source§

fn matches(&mut self, input: &IN, _ctx: &mut ExecutionContext) -> bool

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

source§

impl<IN> Matcher<IN> for String
where IN: AsRef<[u8]> + ?Sized,

A String is an implicit Eq mapper.

source§

fn matches(&mut self, input: &IN, _ctx: &mut ExecutionContext) -> bool

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

source§

impl<IN> Matcher<IN> for Vec<u8>
where IN: AsRef<[u8]> + ?Sized,

A Vec is an implicit Eq mapper.

source§

fn matches(&mut self, input: &IN, _ctx: &mut ExecutionContext) -> bool

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

source§

impl<K, V, KMatcher, VMatcher> Matcher<KV<K, V>> for (KMatcher, VMatcher)
where K: ToOwned + Debug + ?Sized, V: ToOwned + Debug + ?Sized, KMatcher: Matcher<K>, VMatcher: Matcher<V>,

source§

fn matches(&mut self, input: &KV<K, V>, ctx: &mut ExecutionContext) -> bool

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Implementors§

source§

impl<IN> Matcher<IN> for AllOf<IN>
where IN: Debug + ?Sized,

source§

impl<IN> Matcher<IN> for Any
where IN: ?Sized,

source§

impl<IN> Matcher<IN> for AnyOf<IN>
where IN: Debug + ?Sized,

source§

impl<IN> Matcher<IN> for Matches
where IN: AsRef<[u8]> + ?Sized,

source§

impl<IN, F> Matcher<IN> for F
where F: Fn(&IN) -> bool + Send,

source§

impl<IN, M> Matcher<IN> for Lowercase<M>
where IN: AsRef<[u8]> + ?Sized, M: Matcher<[u8]>,

source§

impl<IN, M> Matcher<IN> for UrlDecoded<M>
where IN: AsRef<[u8]> + ?Sized, M: Matcher<[KV<str, str>]>,

source§

impl<IN, T> Matcher<IN> for Eq<T>
where T: Borrow<IN> + Debug + Send + ?Sized, IN: PartialEq + ?Sized,

source§

impl<IN, T, M> Matcher<IN> for JsonDecoded<T, M>
where IN: AsRef<[u8]> + ?Sized, M: Matcher<T>, T: DeserializeOwned + Debug + Send,

source§

impl<M> Matcher<str> for Len<M>
where M: Matcher<usize>,

source§

impl<M> Matcher<BStr> for Len<M>
where M: Matcher<usize>,

source§

impl<M, B> Matcher<Request<B>> for Body<M>
where B: AsRef<[u8]>, M: Matcher<BStr>,

source§

impl<M, B> Matcher<Request<B>> for Headers<M>
where M: Matcher<[KV<str, BStr>]>,

source§

impl<M, B> Matcher<Request<B>> for Method<M>
where M: Matcher<str>,

source§

impl<M, B> Matcher<Request<B>> for Path<M>
where M: Matcher<str>,

source§

impl<M, B> Matcher<Request<B>> for Query<M>
where M: Matcher<str>,

source§

impl<M, E> Matcher<[E]> for Contains<M>
where M: Matcher<E>, E: Debug,

source§

impl<M, IN> Matcher<IN> for Not<M>
where M: Matcher<IN>, IN: Debug + ?Sized,

source§

impl<M, K, V> Matcher<KV<K, V>> for Key<M>
where K: ToOwned + Debug + ?Sized, V: ToOwned + ?Sized, M: Matcher<K>,

source§

impl<M, K, V> Matcher<KV<K, V>> for Value<M>
where K: ToOwned + ?Sized, V: ToOwned + Debug + ?Sized, M: Matcher<V>,

source§

impl<M, P, B> Matcher<Request<B>> for MethodPath<M, P>
where M: Matcher<str>, P: Matcher<str>,

source§

impl<M, T> Matcher<[T]> for Len<M>
where M: Matcher<usize>,