netstack3_device::socket

Trait DeviceSocketContext

Source
pub trait DeviceSocketContext<BT: DeviceSocketTypes>: DeviceIdContext<AnyDevice> {
    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.

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§