Struct quilkin::filters::FilterChain
source · pub struct FilterChain { /* private fields */ }
Expand description
A chain of Filter
s to be executed in order.
Executes each filter, passing the ReadContext
and WriteContext
between each filter’s execution, returning the result of data that has gone
through all of the filters in the chain. If any of the filters in the chain
return None
, then the chain is broken, and None
is returned.
Implementations§
source§impl FilterChain
impl FilterChain
pub fn new( filters: Vec<(String, FilterInstance)> ) -> Result<Self, CreationError>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = Filter> + '_
sourcepub fn try_create_fallible<Item>(
filter_configs: impl IntoIterator<Item = Item>
) -> Result<Self, CreationError>
pub fn try_create_fallible<Item>( filter_configs: impl IntoIterator<Item = Item> ) -> Result<Self, CreationError>
Validates the filter configurations in the provided config and constructs
a FilterChain if all configurations are valid, including the conversion
into a Filter
sourcepub fn try_create(
filter_configs: impl IntoIterator<Item = FilterConfig>
) -> Result<Self, CreationError>
pub fn try_create( filter_configs: impl IntoIterator<Item = FilterConfig> ) -> Result<Self, CreationError>
Validates the filter configurations in the provided config and constructs a FilterChain if all configurations are valid.
Trait Implementations§
source§impl Clone for FilterChain
impl Clone for FilterChain
source§fn clone(&self) -> FilterChain
fn clone(&self) -> FilterChain
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for FilterChain
impl Debug for FilterChain
source§impl Default for FilterChain
impl Default for FilterChain
source§fn default() -> FilterChain
fn default() -> FilterChain
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for FilterChain
impl<'de> Deserialize<'de> for FilterChain
source§fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Filter for FilterChain
impl Filter for FilterChain
source§fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut ReadContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut ReadContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Filter::read
is invoked when the proxy receives data from a
downstream connection on the listening port. Read moresource§fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut WriteContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut WriteContext
) -> Pin<Box<dyn Future<Output = Result<(), FilterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Filter::write
is invoked when the proxy is about to send data to a
downstream connection via the listening port after receiving it via one
of the upstream Endpoints. Read moresource§impl Index<usize> for FilterChain
impl Index<usize> for FilterChain
source§impl JsonSchema for FilterChain
impl JsonSchema for FilterChain
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl PartialEq for FilterChain
impl PartialEq for FilterChain
source§impl Serialize for FilterChain
impl Serialize for FilterChain
source§impl TryFrom<&FilterChain> for FilterChain
impl TryFrom<&FilterChain> for FilterChain
§type Error = CreationError
type Error = CreationError
The type returned in the event of a conversion error.
source§impl TryFrom<&FilterChain> for FilterChain
impl TryFrom<&FilterChain> for FilterChain
§type Error = CreationError
type Error = CreationError
The type returned in the event of a conversion error.
source§impl TryFrom<FilterChain> for FilterChain
impl TryFrom<FilterChain> for FilterChain
§type Error = CreationError
type Error = CreationError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl !RefUnwindSafe for FilterChain
impl Send for FilterChain
impl Sync for FilterChain
impl Unpin for FilterChain
impl !UnwindSafe for FilterChain
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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<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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request