pub enum Predicate<In = Request<Bytes>, Err = ProximaError> {
Always {
_marker: PhantomData<fn(In) -> Err>,
},
Never {
_marker: PhantomData<fn(In) -> Err>,
},
When {
gate: When,
calls: Arc<AtomicU64>,
_marker: PhantomData<fn(In) -> Err>,
},
Unless {
gate: When,
calls: Arc<AtomicU64>,
_marker: PhantomData<fn(In) -> Err>,
},
}Expand description
The config-expressible predicate set, generic over the payload In it
passes through unchanged on admit and the Err it rejects with.
Implements SendPipe/Pipe directly (In -> Result<In, Err>):
Ok(input) on admit, Err::forbidden() on reject — the same payload
FilterConfig’s RejectMode::Drop produces, since drop was always
this crate’s default reject mode (FilterConfig::default). Defaults to
the crate’s own HTTP types (Request<Bytes>, ProximaError) so a
caller instantiates Predicate::<MyIn, MyErr> to gate their own payload
without minting a type and without touching this one.
Variants§
Always
Fields
§
_marker: PhantomData<fn(In) -> Err>Never
Fields
§
_marker: PhantomData<fn(In) -> Err>When
Unless
Implementations§
Trait Implementations§
Source§impl<'de, In, Err> Deserialize<'de> for Predicate<In, Err>
impl<'de, In, Err> Deserialize<'de> for Predicate<In, Err>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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> UnpinSendPipe for Predicate<In, Err>
impl<In, Err> UnpinSendPipe for Predicate<In, Err>
Auto Trait Implementations§
impl<In, Err> Freeze for Predicate<In, Err>
impl<In, Err> RefUnwindSafe for Predicate<In, Err>
impl<In, Err> Send for Predicate<In, Err>
impl<In, Err> Sync for Predicate<In, Err>
impl<In, Err> Unpin for Predicate<In, Err>
impl<In, Err> UnsafeUnpin for Predicate<In, Err>
impl<In, Err> UnwindSafe for Predicate<In, Err>
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<P> PipeExt for Pwhere
P: Pipe,
impl<P> PipeExt for Pwhere
P: Pipe,
Source§fn and_then<Next>(self, next: Next) -> AndThen<Self, Next>
fn and_then<Next>(self, next: Next) -> AndThen<Self, Next>
self.and_then(next) is AndThen::new(self, next) — reads
left-to-right at the call site.Source§fn fanout(self, other: Self) -> FanOut<Self, AllOrNothing>
fn fanout(self, other: Self) -> FanOut<Self, AllOrNothing>
Broadcast to
self and other, all-or-nothing.