Struct SharedClassifier
pub struct SharedClassifier<C> { /* private fields */ }
A MakeClassifier that produces new classifiers by cloning an inner classifier.
When a type implementing ClassifyResponse doesn't depend on information
from the request, SharedClassifier can be used to turn an instance of that type
into a MakeClassifier.
Example
use fmt;
use ;
use Response;
// A response classifier that only considers errors to be failures.
;
// Some function that requires a `MakeClassifier`
// `MyClassifier` doesn't implement `MakeClassifier` but since it doesn't
// care about the incoming request we can make `MyClassifier`s by cloning.
// That is what `SharedClassifier` does.
let make_classifier = new;
// We now have a `MakeClassifier`!
use_make_classifier;
Implementations
impl<C> SharedClassifier<C>
fn new(classifier: C) -> Self where C: ClassifyResponse + Clone,Create a new
SharedClassifierfrom the given classifier.
Trait Implementations
impl<C> MakeClassifier for SharedClassifier<C>
where
C: ClassifyResponse + Clone,
type FailureClass = <C as ClassifyResponse>::FailureClass;type ClassifyEos = <C as ClassifyResponse>::ClassifyEos;type Classifier = C;fn make_classifier<B>(&self, _req: &Request<B>) -> Self::Classifier
impl<C: Clone> Clone for SharedClassifier<C>
fn clone(&self) -> SharedClassifier<C>
impl<C: Debug> Debug for SharedClassifier<C>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<C> Freeze for SharedClassifier<C>
where
C: Freeze,
impl<C> RefUnwindSafe for SharedClassifier<C>
where
C: RefUnwindSafe,
impl<C> Send for SharedClassifier<C>
where
C: Send,
impl<C> Sync for SharedClassifier<C>
where
C: Sync,
impl<C> Unpin for SharedClassifier<C>
where
C: Unpin,
impl<C> UnsafeUnpin for SharedClassifier<C>
where
C: UnsafeUnpin,
impl<C> UnwindSafe for SharedClassifier<C>
where
C: UnwindSafe,
Blanket Implementations
impl<T> Any for SharedClassifier<C>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for SharedClassifier<C>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for SharedClassifier<C>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for SharedClassifier<C>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for SharedClassifier<C>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for SharedClassifier<C>
impl<T> PolicyExt for SharedClassifier<C>
where
T: ?Sized,
fn and<P, B, E>(self, other: P) -> And<T, P> where T: Sized + Policy<B, E>, P: Policy<B, E>,fn or<P, B, E>(self, other: P) -> Or<T, P> where T: Sized + Policy<B, E>, P: Policy<B, E>,
impl<T> ToOwned for SharedClassifier<C>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> WithSubscriber for SharedClassifier<C>
impl<T, U> Into<U> for SharedClassifier<C>
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 SharedClassifier<C>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for SharedClassifier<C>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>