Trait netstack3_device::socket::DeviceSocketContext

source ·
pub trait DeviceSocketContext<BT: DeviceSocketTypes>: DeviceSocketAccessor<BT> {
    type SocketTablesCoreCtx<'a>: DeviceSocketAccessor<BT, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>;

    // Required methods
    fn with_all_device_sockets_mut<F: FnOnce(&mut AllSockets<Self::WeakDeviceId, BT>) -> R, R>(
        &mut self,
        cb: F,
    ) -> R;
    fn with_any_device_sockets<F: FnOnce(&AnyDeviceSockets<Self::WeakDeviceId, BT>, &mut Self::SocketTablesCoreCtx<'_>) -> R, R>(
        &mut self,
        cb: F,
    ) -> R;
    fn with_any_device_sockets_mut<F: FnOnce(&mut AnyDeviceSockets<Self::WeakDeviceId, BT>, &mut Self::SocketTablesCoreCtx<'_>) -> R, R>(
        &mut self,
        cb: F,
    ) -> R;
}
Expand description

Core context for accessing socket state.

Required Associated Types§

source

type SocketTablesCoreCtx<'a>: DeviceSocketAccessor<BT, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>

The core context available in callbacks to methods on this context.

Required Methods§

source

fn with_all_device_sockets_mut<F: FnOnce(&mut AllSockets<Self::WeakDeviceId, BT>) -> R, R>( &mut self, cb: F, ) -> R

Executes the provided callback with mutable access to the collection of all sockets.

source

fn with_any_device_sockets<F: FnOnce(&AnyDeviceSockets<Self::WeakDeviceId, BT>, &mut Self::SocketTablesCoreCtx<'_>) -> R, R>( &mut self, cb: F, ) -> R

Executes the provided callback with immutable access to socket state.

source

fn with_any_device_sockets_mut<F: FnOnce(&mut AnyDeviceSockets<Self::WeakDeviceId, BT>, &mut Self::SocketTablesCoreCtx<'_>) -> R, R>( &mut self, cb: F, ) -> R

Executes the provided callback with mutable access to socket state.

Object Safety§

This trait is not object safe.

Implementors§