netstack3_udp

Trait BoundStateContext

Source
pub trait BoundStateContext<I: IpExt, BC: UdpBindingsContext<I, Self::DeviceId>>: DeviceIdContext<AnyDevice> + UdpStateContext {
    type IpSocketsCtx<'a>: TransportIpContext<I, BC> + MulticastMembershipHandler<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>;
    type DualStackContext: DualStackDatagramBoundStateContext<I, BC, Udp<BC>, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>;
    type NonDualStackContext: NonDualStackDatagramBoundStateContext<I, BC, Udp<BC>, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>;

    // Required methods
    fn with_bound_sockets<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>, &BoundSockets<I, Self::WeakDeviceId, BC>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
    fn with_bound_sockets_mut<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>, &mut BoundSockets<I, Self::WeakDeviceId, BC>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
    fn dual_stack_context(
        &mut self,
    ) -> MaybeDualStack<&mut Self::DualStackContext, &mut Self::NonDualStackContext>;
    fn with_transport_context<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
}
Expand description

An execution context for the UDP protocol which also provides access to state.

Required Associated Types§

Source

type IpSocketsCtx<'a>: TransportIpContext<I, BC> + MulticastMembershipHandler<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>

The core context passed to the callback provided to methods.

Source

type DualStackContext: DualStackDatagramBoundStateContext<I, BC, Udp<BC>, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>

The inner dual stack context.

Source

type NonDualStackContext: NonDualStackDatagramBoundStateContext<I, BC, Udp<BC>, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>

The inner non dual stack context.

Required Methods§

Source

fn with_bound_sockets<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>, &BoundSockets<I, Self::WeakDeviceId, BC>) -> O>( &mut self, cb: F, ) -> O

Calls the function with an immutable reference to UDP sockets.

Source

fn with_bound_sockets_mut<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>, &mut BoundSockets<I, Self::WeakDeviceId, BC>) -> O>( &mut self, cb: F, ) -> O

Calls the function with a mutable reference to UDP sockets.

Source

fn dual_stack_context( &mut self, ) -> MaybeDualStack<&mut Self::DualStackContext, &mut Self::NonDualStackContext>

Returns a context for dual- or non-dual-stack operation.

Source

fn with_transport_context<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>) -> O>( &mut self, cb: F, ) -> O

Calls the function without access to the UDP bound socket state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§