Trait netstack3_datagram::DatagramStateContext

source ·
pub trait DatagramStateContext<I: IpExt, BC, S: DatagramSocketSpec>: DeviceIdContext<AnyDevice> {
    type SocketsStateCtx<'a>: DatagramBoundStateContext<I, BC, S> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>;

    // Required methods
    fn with_all_sockets_mut<O, F: FnOnce(&mut DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
    fn with_all_sockets<O, F: FnOnce(&DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
    fn with_socket_state<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &SocketState<I, Self::WeakDeviceId, S>) -> O>(
        &mut self,
        id: &S::SocketId<I, Self::WeakDeviceId>,
        cb: F,
    ) -> O;
    fn with_socket_state_mut<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &mut SocketState<I, Self::WeakDeviceId, S>) -> O>(
        &mut self,
        id: &S::SocketId<I, Self::WeakDeviceId>,
        cb: F,
    ) -> O;
    fn for_each_socket<F: FnMut(&mut Self::SocketsStateCtx<'_>, &S::SocketId<I, Self::WeakDeviceId>, &SocketState<I, Self::WeakDeviceId, S>)>(
        &mut self,
        cb: F,
    );
}
Expand description

The core context providing access to datagram socket state.

Required Associated Types§

source

type SocketsStateCtx<'a>: DatagramBoundStateContext<I, BC, S> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>

The core context passed to the callback provided to methods.

Required Methods§

source

fn with_all_sockets_mut<O, F: FnOnce(&mut DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>( &mut self, cb: F, ) -> O

Calls the function with mutable access to the set with all datagram sockets.

source

fn with_all_sockets<O, F: FnOnce(&DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>( &mut self, cb: F, ) -> O

Calls the function with immutable access to the set with all datagram sockets.

source

fn with_socket_state<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &SocketState<I, Self::WeakDeviceId, S>) -> O>( &mut self, id: &S::SocketId<I, Self::WeakDeviceId>, cb: F, ) -> O

Calls the function with an immutable reference to the given socket’s state.

source

fn with_socket_state_mut<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &mut SocketState<I, Self::WeakDeviceId, S>) -> O>( &mut self, id: &S::SocketId<I, Self::WeakDeviceId>, cb: F, ) -> O

Calls the function with a mutable reference to the given socket’s state.

source

fn for_each_socket<F: FnMut(&mut Self::SocketsStateCtx<'_>, &S::SocketId<I, Self::WeakDeviceId>, &SocketState<I, Self::WeakDeviceId, S>)>( &mut self, cb: F, )

Call f with each socket’s state.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<I, CC, BC, S> DatagramStateContext<I, BC, S> for CC