netstack3_icmp_echo

Trait IcmpEchoStateContext

Source
pub trait IcmpEchoStateContext<I: IcmpIpExt + IpExt, BC: IcmpEchoBindingsTypes>: DeviceIdContext<AnyDevice> + IcmpEchoContextMarker {
    type SocketStateCtx<'a>: IcmpEchoBoundStateContext<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>;

    // Required methods
    fn with_all_sockets_mut<O, F: FnOnce(&mut IcmpSocketSet<I, Self::WeakDeviceId, BC>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
    fn with_all_sockets<O, F: FnOnce(&IcmpSocketSet<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<'_>, &IcmpSocketState<I, Self::WeakDeviceId, BC>) -> O>(
        &mut self,
        id: &IcmpSocketId<I, Self::WeakDeviceId, BC>,
        cb: F,
    ) -> O;
    fn with_socket_state_mut<O, F: FnOnce(&mut Self::SocketStateCtx<'_>, &mut IcmpSocketState<I, Self::WeakDeviceId, BC>) -> O>(
        &mut self,
        id: &IcmpSocketId<I, Self::WeakDeviceId, BC>,
        cb: F,
    ) -> O;
    fn for_each_socket<F: FnMut(&mut Self::SocketStateCtx<'_>, &IcmpSocketId<I, Self::WeakDeviceId, BC>, &IcmpSocketState<I, Self::WeakDeviceId, BC>)>(
        &mut self,
        cb: F,
    );
}
Expand description

A Context that provides access to the sockets’ states.

Required Associated Types§

Source

type SocketStateCtx<'a>: IcmpEchoBoundStateContext<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId>

The inner socket context.

Required Methods§

Source

fn with_all_sockets_mut<O, F: FnOnce(&mut IcmpSocketSet<I, Self::WeakDeviceId, BC>) -> O>( &mut self, cb: F, ) -> O

Calls the function with mutable access to the set with all ICMP sockets.

Source

fn with_all_sockets<O, F: FnOnce(&IcmpSocketSet<I, Self::WeakDeviceId, BC>) -> O>( &mut self, cb: F, ) -> O

Calls the function with immutable access to the set with all ICMP sockets.

Source

fn with_bound_state_context<O, F: FnOnce(&mut Self::SocketStateCtx<'_>) -> O>( &mut self, cb: F, ) -> O

Calls the function without access to ICMP socket state.

Source

fn with_socket_state<O, F: FnOnce(&mut Self::SocketStateCtx<'_>, &IcmpSocketState<I, Self::WeakDeviceId, BC>) -> O>( &mut self, id: &IcmpSocketId<I, Self::WeakDeviceId, BC>, cb: F, ) -> O

Calls the function with an immutable reference to the given socket’s state.

Source

fn with_socket_state_mut<O, F: FnOnce(&mut Self::SocketStateCtx<'_>, &mut IcmpSocketState<I, Self::WeakDeviceId, BC>) -> O>( &mut self, id: &IcmpSocketId<I, Self::WeakDeviceId, BC>, cb: F, ) -> O

Calls the function with a mutable reference to the given socket’s state.

Source

fn for_each_socket<F: FnMut(&mut Self::SocketStateCtx<'_>, &IcmpSocketId<I, Self::WeakDeviceId, BC>, &IcmpSocketState<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.

Implementors§