pub trait DatagramStateContext<I: IpExt, BC, S: DatagramSocketSpec>: DeviceIdContext<AnyDevice> {
type SocketsStateCtx<'a>: DatagramBoundStateContext<I, BC, S> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>;
// Required methods
fn with_all_sockets_mut<O, F: FnOnce(&mut DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>(
&mut self,
cb: F,
) -> O;
fn with_all_sockets<O, F: FnOnce(&DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>(
&mut self,
cb: F,
) -> O;
fn with_socket_state<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &SocketState<I, Self::WeakDeviceId, S>) -> O>(
&mut self,
id: &S::SocketId<I, Self::WeakDeviceId>,
cb: F,
) -> O;
fn with_socket_state_mut<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &mut SocketState<I, Self::WeakDeviceId, S>) -> O>(
&mut self,
id: &S::SocketId<I, Self::WeakDeviceId>,
cb: F,
) -> O;
fn for_each_socket<F: FnMut(&mut Self::SocketsStateCtx<'_>, &S::SocketId<I, Self::WeakDeviceId>, &SocketState<I, Self::WeakDeviceId, S>)>(
&mut self,
cb: F,
);
}
Expand description
The core context providing access to datagram socket state.
Required Associated Types§
Sourcetype SocketsStateCtx<'a>: DatagramBoundStateContext<I, BC, S> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>
type SocketsStateCtx<'a>: DatagramBoundStateContext<I, BC, S> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>
The core context passed to the callback provided to methods.
Required Methods§
Sourcefn with_all_sockets_mut<O, F: FnOnce(&mut DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>(
&mut self,
cb: F,
) -> O
fn with_all_sockets_mut<O, F: FnOnce(&mut DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>( &mut self, cb: F, ) -> O
Calls the function with mutable access to the set with all datagram sockets.
Sourcefn with_all_sockets<O, F: FnOnce(&DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>(
&mut self,
cb: F,
) -> O
fn with_all_sockets<O, F: FnOnce(&DatagramSocketSet<I, Self::WeakDeviceId, S>) -> O>( &mut self, cb: F, ) -> O
Calls the function with immutable access to the set with all datagram sockets.
Sourcefn with_socket_state<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &SocketState<I, Self::WeakDeviceId, S>) -> O>(
&mut self,
id: &S::SocketId<I, Self::WeakDeviceId>,
cb: F,
) -> O
fn with_socket_state<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &SocketState<I, Self::WeakDeviceId, S>) -> O>( &mut self, id: &S::SocketId<I, Self::WeakDeviceId>, cb: F, ) -> O
Calls the function with an immutable reference to the given socket’s state.
Sourcefn with_socket_state_mut<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &mut SocketState<I, Self::WeakDeviceId, S>) -> O>(
&mut self,
id: &S::SocketId<I, Self::WeakDeviceId>,
cb: F,
) -> O
fn with_socket_state_mut<O, F: FnOnce(&mut Self::SocketsStateCtx<'_>, &mut SocketState<I, Self::WeakDeviceId, S>) -> O>( &mut self, id: &S::SocketId<I, Self::WeakDeviceId>, cb: F, ) -> O
Calls the function with a mutable reference to the given socket’s state.
Sourcefn for_each_socket<F: FnMut(&mut Self::SocketsStateCtx<'_>, &S::SocketId<I, Self::WeakDeviceId>, &SocketState<I, Self::WeakDeviceId, S>)>(
&mut self,
cb: F,
)
fn for_each_socket<F: FnMut(&mut Self::SocketsStateCtx<'_>, &S::SocketId<I, Self::WeakDeviceId>, &SocketState<I, Self::WeakDeviceId, S>)>( &mut self, cb: F, )
Call f
with each socket’s 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.