Trait netstack3_device::socket::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.

Object Safety§

This trait is not object safe.

Implementors§