pub trait StateContext<I: IpExt, BC: UdpBindingsContext<I, Self::DeviceId>>: DeviceIdContext<AnyDevice> {
type SocketStateCtx<'a>: BoundStateContext<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + UdpStateContext;
// Required methods
fn with_all_sockets_mut<O, F: FnOnce(&mut UdpSocketSet<I, Self::WeakDeviceId, BC>) -> O>(
&mut self,
cb: F,
) -> O;
fn with_all_sockets<O, F: FnOnce(&UdpSocketSet<I, Self::WeakDeviceId, BC>) -> O>(
&mut self,
cb: F,
) -> O;
fn with_bound_state_context<O, F: FnOnce(&mut Self::SocketStateCtx<'_>) -> O>(
&mut self,
cb: F,
) -> O;
fn with_socket_state<O, F: FnOnce(&mut Self::SocketStateCtx<'_>, &UdpSocketState<I, Self::WeakDeviceId, BC>) -> O>(
&mut self,
id: &UdpSocketId<I, Self::WeakDeviceId, BC>,
cb: F,
) -> O;
fn with_socket_state_mut<O, F: FnOnce(&mut Self::SocketStateCtx<'_>, &mut UdpSocketState<I, Self::WeakDeviceId, BC>) -> O>(
&mut self,
id: &UdpSocketId<I, Self::WeakDeviceId, BC>,
cb: F,
) -> O;
fn should_send_port_unreachable(&mut self) -> bool;
fn for_each_socket<F: FnMut(&mut Self::SocketStateCtx<'_>, &UdpSocketId<I, Self::WeakDeviceId, BC>, &UdpSocketState<I, Self::WeakDeviceId, BC>)>(
&mut self,
cb: F,
);
}
Expand description
Core context abstracting state access to UDP state.
Required Associated Types§
Sourcetype SocketStateCtx<'a>: BoundStateContext<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + UdpStateContext
type SocketStateCtx<'a>: BoundStateContext<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + UdpStateContext
The core context passed to the callback.
Required Methods§
Sourcefn with_all_sockets_mut<O, F: FnOnce(&mut UdpSocketSet<I, Self::WeakDeviceId, BC>) -> O>(
&mut self,
cb: F,
) -> O
fn with_all_sockets_mut<O, F: FnOnce(&mut UdpSocketSet<I, Self::WeakDeviceId, BC>) -> O>( &mut self, cb: F, ) -> O
Calls the function with mutable access to the set with all UDP sockets.
Sourcefn with_all_sockets<O, F: FnOnce(&UdpSocketSet<I, Self::WeakDeviceId, BC>) -> O>(
&mut self,
cb: F,
) -> O
fn with_all_sockets<O, F: FnOnce(&UdpSocketSet<I, Self::WeakDeviceId, BC>) -> O>( &mut self, cb: F, ) -> O
Calls the function with immutable access to the set with all UDP sockets.
Sourcefn with_bound_state_context<O, F: FnOnce(&mut Self::SocketStateCtx<'_>) -> O>(
&mut self,
cb: F,
) -> O
fn with_bound_state_context<O, F: FnOnce(&mut Self::SocketStateCtx<'_>) -> O>( &mut self, cb: F, ) -> O
Calls the function without access to UDP socket state.
Sourcefn with_socket_state<O, F: FnOnce(&mut Self::SocketStateCtx<'_>, &UdpSocketState<I, Self::WeakDeviceId, BC>) -> O>(
&mut self,
id: &UdpSocketId<I, Self::WeakDeviceId, BC>,
cb: F,
) -> O
fn with_socket_state<O, F: FnOnce(&mut Self::SocketStateCtx<'_>, &UdpSocketState<I, Self::WeakDeviceId, BC>) -> O>( &mut self, id: &UdpSocketId<I, Self::WeakDeviceId, BC>, 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::SocketStateCtx<'_>, &mut UdpSocketState<I, Self::WeakDeviceId, BC>) -> O>(
&mut self,
id: &UdpSocketId<I, Self::WeakDeviceId, BC>,
cb: F,
) -> O
fn with_socket_state_mut<O, F: FnOnce(&mut Self::SocketStateCtx<'_>, &mut UdpSocketState<I, Self::WeakDeviceId, BC>) -> O>( &mut self, id: &UdpSocketId<I, Self::WeakDeviceId, BC>, cb: F, ) -> O
Calls the function with a mutable reference to the given socket’s state.
Sourcefn should_send_port_unreachable(&mut self) -> bool
fn should_send_port_unreachable(&mut self) -> bool
Returns true if UDP may send a port unreachable ICMP error message.
Sourcefn for_each_socket<F: FnMut(&mut Self::SocketStateCtx<'_>, &UdpSocketId<I, Self::WeakDeviceId, BC>, &UdpSocketState<I, Self::WeakDeviceId, BC>)>(
&mut self,
cb: F,
)
fn for_each_socket<F: FnMut(&mut Self::SocketStateCtx<'_>, &UdpSocketId<I, Self::WeakDeviceId, BC>, &UdpSocketState<I, Self::WeakDeviceId, BC>)>( &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.