Trait netstack3_ip::raw::RawIpSocketStateContext
source · pub trait RawIpSocketStateContext<I: IpExt, 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§
sourcetype SocketHandler<'a>: IpSocketHandler<I, BT, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>
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§
sourcefn 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<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.
sourcefn 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_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
.
sourcefn with_locked_state_mut<O, F: FnOnce(&mut RawIpSocketLockedState<I, Self::WeakDeviceId>) -> 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
Calls the callback with a mutable reference to the socket’s locked state.
Object Safety§
This trait is not object safe.