Struct SocketMatcher
pub struct SocketMatcher<Socket> { /* private fields */ }
Expand description
A matcher to match on a Socket
.
Implementations§
§impl<Socket> SocketMatcher<Socket>
impl<Socket> SocketMatcher<Socket>
pub fn socket_addr(addr: impl Into<SocketAddr>) -> SocketMatcher<Socket>
pub fn socket_addr(addr: impl Into<SocketAddr>) -> SocketMatcher<Socket>
Create a new socket address matcher to match on a socket address.
See SocketAddressMatcher::new
for more information.
pub fn optional_socket_addr(
addr: impl Into<SocketAddr>,
) -> SocketMatcher<Socket>
pub fn optional_socket_addr( addr: impl Into<SocketAddr>, ) -> SocketMatcher<Socket>
Create a new optional socket address matcher to match on a socket address, this matcher will match in case socket address could not be found.
See SocketAddressMatcher::optional
for more information.
pub fn and_socket_addr(
self,
addr: impl Into<SocketAddr>,
) -> SocketMatcher<Socket>
pub fn and_socket_addr( self, addr: impl Into<SocketAddr>, ) -> SocketMatcher<Socket>
Add a new socket address matcher to the existing SocketMatcher
to also match on a socket address.
pub fn and_optional_socket_addr(
self,
addr: impl Into<SocketAddr>,
) -> SocketMatcher<Socket>
pub fn and_optional_socket_addr( self, addr: impl Into<SocketAddr>, ) -> SocketMatcher<Socket>
Add a new optional socket address matcher to the existing SocketMatcher
to also match on a socket address.
See SocketAddressMatcher::optional
for more information.
pub fn or_socket_addr(
self,
addr: impl Into<SocketAddr>,
) -> SocketMatcher<Socket>
pub fn or_socket_addr( self, addr: impl Into<SocketAddr>, ) -> SocketMatcher<Socket>
Add a new socket address matcher to the existing SocketMatcher
as an alternative matcher to match on a socket address.
See SocketAddressMatcher::new
for more information.
pub fn or_optional_socket_addr(
self,
addr: impl Into<SocketAddr>,
) -> SocketMatcher<Socket>
pub fn or_optional_socket_addr( self, addr: impl Into<SocketAddr>, ) -> SocketMatcher<Socket>
Add a new optional socket address matcher to the existing SocketMatcher
as an alternative matcher to match on a socket address.
See SocketAddressMatcher::optional
for more information.
pub fn loopback() -> SocketMatcher<Socket>
pub fn loopback() -> SocketMatcher<Socket>
create a new loopback matcher to match on whether or not the peer address is a loopback address.
See LoopbackMatcher::new
for more information.
pub fn optional_loopback() -> SocketMatcher<Socket>
pub fn optional_loopback() -> SocketMatcher<Socket>
Create a new optional loopback matcher to match on whether or not the peer address is a loopback address, this matcher will match in case socket address could not be found.
See LoopbackMatcher::optional
for more information.
pub fn and_loopback(self) -> SocketMatcher<Socket>
pub fn and_loopback(self) -> SocketMatcher<Socket>
Add a new loopback matcher to the existing SocketMatcher
to also match on whether or not the peer address is a loopback address.
See LoopbackMatcher::new
for more information.
pub fn and_optional_loopback(self) -> SocketMatcher<Socket>
pub fn and_optional_loopback(self) -> SocketMatcher<Socket>
Add a new loopback matcher to the existing SocketMatcher
to also match on whether or not the peer address is a loopback address.
See LoopbackMatcher::optional
for more information.
pub fn or_loopback(self) -> SocketMatcher<Socket>
pub fn or_loopback(self) -> SocketMatcher<Socket>
Add a new loopback matcher to the existing SocketMatcher
as an alternative matcher to match on whether or not the peer address is a loopback address.
See LoopbackMatcher::new
for more information.
pub fn or_optional_loopback(self) -> SocketMatcher<Socket>
pub fn or_optional_loopback(self) -> SocketMatcher<Socket>
Add a new loopback matcher to the existing SocketMatcher
as an alternative matcher to match on whether or not the peer address is a loopback address.
See LoopbackMatcher::optional
for more information.
pub fn port(port: u16) -> SocketMatcher<Socket>
pub fn port(port: u16) -> SocketMatcher<Socket>
create a new port matcher to match on the port part a SocketAddr
.
See PortMatcher::new
for more information.
pub fn optional_port(port: u16) -> SocketMatcher<Socket>
pub fn optional_port(port: u16) -> SocketMatcher<Socket>
Create a new optional port matcher to match on the port part a SocketAddr
,
this matcher will match in case socket address could not be found.
See PortMatcher::optional
for more information.
pub fn and_port(self, port: u16) -> SocketMatcher<Socket>
pub fn and_port(self, port: u16) -> SocketMatcher<Socket>
Add a new port matcher to the existing SocketMatcher
to
also matcher on the port part of the SocketAddr
.
See PortMatcher::new
for more information.
pub fn and_optional_port(self, port: u16) -> SocketMatcher<Socket>
pub fn and_optional_port(self, port: u16) -> SocketMatcher<Socket>
Add a new port matcher to the existing SocketMatcher
as an alternative matcher
to match on the port part of the SocketAddr
.
See PortMatcher::optional
for more information.
pub fn or_port(self, port: u16) -> SocketMatcher<Socket>
pub fn or_port(self, port: u16) -> SocketMatcher<Socket>
Add a new port matcher to the existing SocketMatcher
as an alternative matcher
to match on the port part of the SocketAddr
.
See PortMatcher::new
for more information.
pub fn or_optional_port(self, port: u16) -> SocketMatcher<Socket>
pub fn or_optional_port(self, port: u16) -> SocketMatcher<Socket>
Add a new port matcher to the existing SocketMatcher
as an alternative matcher
to match on the port part of the SocketAddr
.
See PortMatcher::optional
for more information.
pub fn ip_net(ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
pub fn ip_net(ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
create a new IP network matcher to match on an IP Network.
See IpNetMatcher::new
for more information.
pub fn optional_ip_net(ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
pub fn optional_ip_net(ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
Create a new optional IP network matcher to match on an IP Network, this matcher will match in case socket address could not be found.
See IpNetMatcher::optional
for more information.
pub fn and_ip_net(self, ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
pub fn and_ip_net(self, ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
Add a new IP network matcher to the existing SocketMatcher
to also match on an IP Network.
See IpNetMatcher::new
for more information.
pub fn and_optional_ip_net(
self,
ip_net: impl IntoIpNet,
) -> SocketMatcher<Socket>
pub fn and_optional_ip_net( self, ip_net: impl IntoIpNet, ) -> SocketMatcher<Socket>
Add a new IP network matcher to the existing SocketMatcher
as an alternative matcher to match on an IP Network.
See IpNetMatcher::optional
for more information.
pub fn or_ip_net(self, ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
pub fn or_ip_net(self, ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
Add a new IP network matcher to the existing SocketMatcher
as an alternative matcher to match on an IP Network.
See IpNetMatcher::new
for more information.
pub fn or_optional_ip_net(self, ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
pub fn or_optional_ip_net(self, ip_net: impl IntoIpNet) -> SocketMatcher<Socket>
Add a new IP network matcher to the existing SocketMatcher
as an alternative matcher to match on an IP Network.
See IpNetMatcher::optional
for more information.
pub fn private_ip_net() -> SocketMatcher<Socket>
pub fn private_ip_net() -> SocketMatcher<Socket>
create a new local IP network matcher to match on whether or not the peer address is a private address.
See PrivateIpNetMatcher::new
for more information.
pub fn optional_private_ip_net() -> SocketMatcher<Socket>
pub fn optional_private_ip_net() -> SocketMatcher<Socket>
Create a new optional local IP network matcher to match on whether or not the peer address is a private address, this matcher will match in case socket address could not be found.
See PrivateIpNetMatcher::optional
for more information.
pub fn and_private_ip_net(self) -> SocketMatcher<Socket>
pub fn and_private_ip_net(self) -> SocketMatcher<Socket>
Add a new local IP network matcher to the existing SocketMatcher
to also match on whether or not the peer address is a private address.
See PrivateIpNetMatcher::new
for more information.
pub fn and_optional_private_ip_net(self) -> SocketMatcher<Socket>
pub fn and_optional_private_ip_net(self) -> SocketMatcher<Socket>
Add a new local IP network matcher to the existing SocketMatcher
to also match on whether or not the peer address is a private address.
See PrivateIpNetMatcher::optional
for more information.
pub fn or_private_ip_net(self) -> SocketMatcher<Socket>
pub fn or_private_ip_net(self) -> SocketMatcher<Socket>
Add a new local IP network matcher to the existing SocketMatcher
as an alternative matcher to match on whether or not the peer address is a private address.
See PrivateIpNetMatcher::new
for more information.
pub fn or_optional_private_ip_net(self) -> SocketMatcher<Socket>
pub fn or_optional_private_ip_net(self) -> SocketMatcher<Socket>
Add a new local IP network matcher to the existing SocketMatcher
as an alternative matcher to match on whether or not the peer address is a private address.
See PrivateIpNetMatcher::optional
for more information.
pub fn custom<M>(matcher: M) -> SocketMatcher<Socket>where
M: Matcher<Socket>,
pub fn custom<M>(matcher: M) -> SocketMatcher<Socket>where
M: Matcher<Socket>,
Create a matcher that matches according to a custom predicate.
See rama_core::matcher::Matcher
for more information.
pub fn and_custom<M>(self, matcher: M) -> SocketMatcher<Socket>where
M: Matcher<Socket>,
pub fn and_custom<M>(self, matcher: M) -> SocketMatcher<Socket>where
M: Matcher<Socket>,
Add a custom matcher to match on top of the existing set of SocketMatcher
matchers.
See rama_core::matcher::Matcher
for more information.
pub fn or_custom<M>(self, matcher: M) -> SocketMatcher<Socket>where
M: Matcher<Socket>,
pub fn or_custom<M>(self, matcher: M) -> SocketMatcher<Socket>where
M: Matcher<Socket>,
Create a custom matcher to match as an alternative to the existing set of SocketMatcher
matchers.
See rama_core::matcher::Matcher
for more information.
pub fn and(self, matcher: SocketMatcher<Socket>) -> SocketMatcher<Socket>
pub fn and(self, matcher: SocketMatcher<Socket>) -> SocketMatcher<Socket>
Add a SocketMatcher
to match on top of the existing set of SocketMatcher
matchers.
pub fn or(self, matcher: SocketMatcher<Socket>) -> SocketMatcher<Socket>
pub fn or(self, matcher: SocketMatcher<Socket>) -> SocketMatcher<Socket>
Create a SocketMatcher
matcher to match as an alternative to the existing set of SocketMatcher
matchers.
pub fn negate(self) -> SocketMatcher<Socket>
pub fn negate(self) -> SocketMatcher<Socket>
Negate the current matcher
Trait Implementations§
§impl<Socket> Clone for SocketMatcher<Socket>
impl<Socket> Clone for SocketMatcher<Socket>
§fn clone(&self) -> SocketMatcher<Socket>
fn clone(&self) -> SocketMatcher<Socket>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<Socket> Debug for SocketMatcher<Socket>
impl<Socket> Debug for SocketMatcher<Socket>
§impl<Body> Matcher<Request<Body>> for SocketMatcher<Request<Body>>where
Body: 'static,
impl<Body> Matcher<Request<Body>> for SocketMatcher<Request<Body>>where
Body: 'static,
§fn matches(
&self,
ext: Option<&mut Extensions>,
ctx: &Context,
req: &Request<Body>,
) -> bool
fn matches( &self, ext: Option<&mut Extensions>, ctx: &Context, req: &Request<Body>, ) -> bool
§fn or<M>(self, other: M) -> impl Matcher<Request>
fn or<M>(self, other: M) -> impl Matcher<Request>
§impl<Socket> Matcher<Socket> for SocketMatcher<Socket>where
Socket: Socket,
impl<Socket> Matcher<Socket> for SocketMatcher<Socket>where
Socket: Socket,
§fn matches(
&self,
ext: Option<&mut Extensions>,
ctx: &Context,
stream: &Socket,
) -> bool
fn matches( &self, ext: Option<&mut Extensions>, ctx: &Context, stream: &Socket, ) -> bool
§fn or<M>(self, other: M) -> impl Matcher<Request>
fn or<M>(self, other: M) -> impl Matcher<Request>
Auto Trait Implementations§
impl<Socket> Freeze for SocketMatcher<Socket>
impl<Socket> !RefUnwindSafe for SocketMatcher<Socket>
impl<Socket> Send for SocketMatcher<Socket>
impl<Socket> Sync for SocketMatcher<Socket>
impl<Socket> Unpin for SocketMatcher<Socket>
impl<Socket> !UnwindSafe for SocketMatcher<Socket>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§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> 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> ⓘ
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> ⓘ
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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more