Trait netstack3_icmp_echo::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.

Object Safety§

This trait is not object safe.

Implementors§