Skip to main content

RawIpSocketStateContext

Trait RawIpSocketStateContext 

Source
pub trait RawIpSocketStateContext<I: IpExt + FilterIpExt, BT: RawIpSocketsBindingsTypes>: DeviceIdContext<AnyDevice> {
    type SocketHandler<'a>: IpSocketHandler<I, BT, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>;

    // Required methods
    fn with_locked_state<O, F: FnOnce(&RawIpSocketLockedState<I, Self::WeakDeviceId>) -> O>(
        &mut self,
        id: &RawIpSocketId<I, Self::WeakDeviceId, BT>,
        cb: F,
    ) -> O;
    fn with_locked_state_and_socket_handler<O, F: FnOnce(&RawIpSocketLockedState<I, Self::WeakDeviceId>, &mut Self::SocketHandler<'_>) -> O>(
        &mut self,
        id: &RawIpSocketId<I, Self::WeakDeviceId, BT>,
        cb: F,
    ) -> O;
    fn with_locked_state_mut<O, F: FnOnce(&mut RawIpSocketLockedState<I, Self::WeakDeviceId>) -> O>(
        &mut self,
        id: &RawIpSocketId<I, Self::WeakDeviceId, BT>,
        cb: F,
    ) -> O;
}
Expand description

Provides access to the RawIpSocketLockedState for a raw IP socket.

Implementations must ensure a proper lock ordering is adhered to.

Required Associated Types§

Source

type SocketHandler<'a>: IpSocketHandler<I, BT, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>

The implementation of IpSocketHandler available after having locked the state for an individual socket.

Required Methods§

Source

fn with_locked_state<O, F: FnOnce(&RawIpSocketLockedState<I, Self::WeakDeviceId>) -> O>( &mut self, id: &RawIpSocketId<I, Self::WeakDeviceId, BT>, cb: F, ) -> O

Calls the callback with an immutable reference to the socket’s locked state.

Source

fn with_locked_state_and_socket_handler<O, F: FnOnce(&RawIpSocketLockedState<I, Self::WeakDeviceId>, &mut Self::SocketHandler<'_>) -> O>( &mut self, id: &RawIpSocketId<I, Self::WeakDeviceId, BT>, cb: F, ) -> O

Calls the callback with an immutable reference to the socket’s locked state and the SocketHandler.

Source

fn with_locked_state_mut<O, F: FnOnce(&mut RawIpSocketLockedState<I, Self::WeakDeviceId>) -> O>( &mut self, id: &RawIpSocketId<I, Self::WeakDeviceId, BT>, cb: F, ) -> O

Calls the callback with a mutable reference to the socket’s locked state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§