Skip to main content

FilterConfig

Struct FilterConfig 

Source
pub struct FilterConfig<In = Request<Bytes>, Err = ProximaError> {
    pub predicate: Predicate<In, Err>,
    pub on_reject: RejectMode,
}
Expand description

The predicate-gated pass/reject decision, as config and as the pipe itself: FilterConfig is both the 1:1 serialisable mirror AND the SendPipe/Pipe implementor (In -> Result<In, Err>, generic over both like Predicate) — its two fields are exactly what a decision needs (the gate, and which error a reject produces), so no separate combinator carries them, and no separate type is needed to use it at a payload of the caller’s own: FilterConfig { predicate, on_reject }.and_then(inner) composes at any In/Err the same way Predicate does. Only FilterConfig::into_filter/FilterConfig::from_spec stay pinned to this crate’s HTTP PipeHandle, because PipeFactory’s own signature is pinned there — not a constraint this module introduces.

Fields§

§predicate: Predicate<In, Err>§on_reject: RejectMode

Implementations§

Source§

impl FilterConfig<Request<Bytes>, ProximaError>

Source

pub fn into_filter(self, inner: PipeHandle) -> PipeHandle

Compose the decision in front of inner and erase — predicate. and_then(inner) in one call, matching every other into_* factory entry point in this crate (Delay::into_delay, Transform:: into_transform, …).

Source

pub fn from_spec( inner: PipeHandle, value: &Value, ) -> Result<PipeHandle, ProximaError>

Trait Implementations§

Source§

impl<In, Err> Clone for FilterConfig<In, Err>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<In, Err> Debug for FilterConfig<In, Err>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<In, Err> Default for FilterConfig<In, Err>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, In, Err> Deserialize<'de> for FilterConfig<In, Err>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<In, Err> PartialEq for FilterConfig<In, Err>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<In, Err> Pipe for FilterConfig<In, Err>
where In: 'static, Err: From<RejectMode> + Debug + 'static,

Source§

type In = In

Input the pipe consumes.
Source§

type Out = In

Output the pipe produces.
Source§

type Err = Err

Error the pipe can fail with. Debug + 'static; Send is added only on the cross-core SendPipe form.
Source§

fn call(&self, input: In) -> impl Future<Output = Result<In, Err>>

Apply the pipe. The returned future is NOT required to be Send.
Source§

impl<In, Err> SendPipe for FilterConfig<In, Err>
where In: Send + 'static, Err: From<RejectMode> + Debug + Send + 'static,

Source§

type In = In

Input the pipe consumes.
Source§

type Out = In

Output the pipe produces.
Source§

type Err = Err

Error the pipe can fail with — Send here so it can cross cores.
Source§

fn call(&self, input: In) -> impl Future<Output = Result<In, Err>> + Send

Apply the pipe. The returned future IS Send.
Source§

impl<In, Err> Serialize for FilterConfig<In, Err>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<In, Err> UnpinPipe for FilterConfig<In, Err>
where In: 'static, Err: From<RejectMode> + Debug + 'static,

Source§

type In = In

Input the pipe consumes.
Source§

type Out = In

Output the pipe produces.
Source§

type Err = Err

Error the pipe can fail with.
Source§

fn call(&self, input: In) -> impl Future<Output = Result<In, Err>> + Unpin

Apply the pipe. The returned future IS Unpin — pollable in place.
Source§

impl<In, Err> UnpinSendPipe for FilterConfig<In, Err>
where In: Send + 'static, Err: From<RejectMode> + Debug + Send + 'static,

Source§

type In = In

Input the pipe consumes.
Source§

type Out = In

Output the pipe produces.
Source§

type Err = Err

Error the pipe can fail with — Send here so it can cross cores.
Source§

fn call( &self, input: In, ) -> impl Future<Output = Result<In, Err>> + Send + Unpin

Apply the pipe. The returned future is Send AND Unpin.

Auto Trait Implementations§

§

impl<In, Err> Freeze for FilterConfig<In, Err>
where Predicate<In, Err>: Freeze,

§

impl<In, Err> RefUnwindSafe for FilterConfig<In, Err>
where Predicate<In, Err>: RefUnwindSafe,

§

impl<In, Err> Send for FilterConfig<In, Err>
where Predicate<In, Err>: Send,

§

impl<In, Err> Sync for FilterConfig<In, Err>
where Predicate<In, Err>: Sync,

§

impl<In, Err> Unpin for FilterConfig<In, Err>
where Predicate<In, Err>: Unpin,

§

impl<In, Err> UnsafeUnpin for FilterConfig<In, Err>
where Predicate<In, Err>: UnsafeUnpin,

§

impl<In, Err> UnwindSafe for FilterConfig<In, Err>
where Predicate<In, Err>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<P> DynPipe<<P as Pipe>::In, <P as Pipe>::Out> for P
where P: Pipe, ProximaError: From<<P as Pipe>::Err>,

Source§

fn call_dyn( &self, input: <P as Pipe>::In, ) -> Pin<Box<dyn Future<Output = Result<<P as Pipe>::Out, ProximaError>> + '_>>

Erased dispatch — boxes the inner pipe’s future and converts its error into ProximaError.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P> PipeExt for P
where P: Pipe,

Source§

fn and_then<Next>(self, next: Next) -> AndThen<Self, Next>
where Next: Pipe<In = Self::Out>, Next::Err: From<Self::Err>,

self.and_then(next) is AndThen::new(self, next) — reads left-to-right at the call site.
Source§

fn filter<Pred>(self, predicate: Pred) -> AndThen<Pred, Self>
where Pred: Pipe<Out = Self::In>, Self::Err: From<Pred::Err>,

Gate self behind predicate.
Source§

fn fanout(self, other: Self) -> FanOut<Self, AllOrNothing>
where Self: Clone, Self::In: Clone,

Broadcast to self and other, all-or-nothing.
Source§

fn fanin<Strategy>( self, other: Self, strategy: Strategy, ) -> FanIn<Self, Strategy, 2>
where Self: UnpinPipe<In = (), Err = Exhausted> + DropSafe, Strategy: FanInStrategy,

Merge self and other into a two-source FanIn. FanIn sources are UnpinPipe-shaped (In = (), Err = Exhausted), hence the extra bound.
Source§

impl<P> SendDynPipe<<P as SendPipe>::In, <P as SendPipe>::Out> for P
where P: SendPipe, <P as SendPipe>::In: Send, ProximaError: From<<P as SendPipe>::Err>,

Source§

fn call_dyn( &self, input: <P as SendPipe>::In, ) -> Pin<Box<dyn Future<Output = Result<<P as SendPipe>::Out, ProximaError>> + Send + '_>>

Erased dispatch — boxes the inner pipe’s Send future and converts its error into ProximaError.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more