netstack3_datagram

Trait 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.

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§

Source§

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