netstack3_device::socket

Trait DeviceSocketAccessor

Source
pub trait DeviceSocketAccessor<BT: DeviceSocketTypes>: SocketStateAccessor<BT> {
    type DeviceSocketCoreCtx<'a>: SocketStateAccessor<BT, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>;

    // Required methods
    fn with_device_sockets<F: FnOnce(&DeviceSockets<Self::WeakDeviceId, BT>, &mut Self::DeviceSocketCoreCtx<'_>) -> R, R>(
        &mut self,
        device: &Self::DeviceId,
        cb: F,
    ) -> R;
    fn with_device_sockets_mut<F: FnOnce(&mut DeviceSockets<Self::WeakDeviceId, BT>, &mut Self::DeviceSocketCoreCtx<'_>) -> R, R>(
        &mut self,
        device: &Self::DeviceId,
        cb: F,
    ) -> R;
}
Expand description

Core context for accessing the socket state for a device.

Required Associated Types§

Source

type DeviceSocketCoreCtx<'a>: SocketStateAccessor<BT, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>

Core context available in callbacks to methods on this context.

Required Methods§

Source

fn with_device_sockets<F: FnOnce(&DeviceSockets<Self::WeakDeviceId, BT>, &mut Self::DeviceSocketCoreCtx<'_>) -> R, R>( &mut self, device: &Self::DeviceId, cb: F, ) -> R

Executes the provided callback with immutable access to device-specific socket state.

Source

fn with_device_sockets_mut<F: FnOnce(&mut DeviceSockets<Self::WeakDeviceId, BT>, &mut Self::DeviceSocketCoreCtx<'_>) -> R, R>( &mut self, device: &Self::DeviceId, cb: F, ) -> R

Executes the provided callback with mutable access to device-specific 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§