pub struct WeakConntrackConnection(/* private fields */);
Expand description
A type-erased weak handle to a connection tracking entry.
We use type erasure here to get rid of the parameterization on IP version; this handle is meant to be able to transit the device layer and at that point things are not parameterized on IP version (IPv4 and IPv6 packets both end up in the same device queue, for example).
When this is received for incoming packets, WeakConnection::into_inner
can be used to downcast to the expected concrete [Connection
] type.
Implementations§
Source§impl WeakConnection
impl WeakConnection
Sourcepub fn new<I: IpExt, BT: FilterBindingsTypes + 'static, E: Send + Sync + 'static>(
conn: &Connection<I, E, BT>,
) -> Option<Self>
pub fn new<I: IpExt, BT: FilterBindingsTypes + 'static, E: Send + Sync + 'static>( conn: &Connection<I, E, BT>, ) -> Option<Self>
Creates a new type-erased weak handle to the provided conntrack entry, provided it is a shared entry.
Sourcepub fn into_inner<I: IpExt, BT: FilterBindingsTypes + 'static, E: Send + Sync + 'static>(
self,
) -> Result<Connection<I, E, BT>, WeakConnectionError>
pub fn into_inner<I: IpExt, BT: FilterBindingsTypes + 'static, E: Send + Sync + 'static>( self, ) -> Result<Connection<I, E, BT>, WeakConnectionError>
Attempts to upgrade the provided weak handle to the conntrack entry and
downcast it to the specified concrete [Connection
] type.
Fails if either the weak handle cannot be upgraded (because the conntrack entry has since been removed), or the type-erased handle cannot be downcast to the concrete type (because the packet was modified after the creation of this handle such that it no longer matches, e.g. the IP version of the connection).
Trait Implementations§
Source§impl Clone for WeakConnection
impl Clone for WeakConnection
Source§fn clone(&self) -> WeakConnection
fn clone(&self) -> WeakConnection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for WeakConnection
impl !RefUnwindSafe for WeakConnection
impl Send for WeakConnection
impl Sync for WeakConnection
impl Unpin for WeakConnection
impl !UnwindSafe for WeakConnection
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
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