embassy-net

Crates

git

Versions

default

Flavors

Struct PingManager

Source
pub struct PingManager<'d> { /* private fields */ }
Expand description

Manages ICMP ping operations.

This struct provides functionality to send ICMP echo requests (pings) to a specified target and measure the round-trip time for the requests. It supports both IPv4 and IPv6, depending on the enabled features.

§Fields

  • stack - The network stack instance used for managing network operations.
  • rx_meta - Metadata buffer for receiving packets.
  • rx_buffer - Buffer for receiving packets.
  • tx_meta - Metadata buffer for transmitting packets.
  • tx_buffer - Buffer for transmitting packets.
  • ident - Identifier for the ICMP echo requests.

§Methods

  • new - Creates a new instance of PingManager with the specified stack and buffers.
  • ping - Sends ICMP echo requests to the specified target and returns the average round-trip time.

Implementations§

Source§

impl<'d> PingManager<'d>

Source

pub fn new( stack: Stack<'d>, rx_meta: &'d mut [PacketMetadata], rx_buffer: &'d mut [u8], tx_meta: &'d mut [PacketMetadata], tx_buffer: &'d mut [u8], ) -> Self

Creates a new instance of PingManager with a Stack instance and the buffers used for RX and TX.

note: This does not yet creates the ICMP socket.

Source

pub async fn ping<'a>( &mut self, params: &PingParams<'a>, ) -> Result<Duration, PingError>

Sends ICMP echo requests to the specified target and returns the average round-trip time.

§Arguments
  • params - Parameters for configuring the ping operation.
§Returns
  • Ok(Duration) - The average round-trip time for the ping requests.
  • Err(PingError) - An error occurred during the ping operation.

Auto Trait Implementations§

§

impl<'d> Freeze for PingManager<'d>

§

impl<'d> !RefUnwindSafe for PingManager<'d>

§

impl<'d> !Send for PingManager<'d>

§

impl<'d> !Sync for PingManager<'d>

§

impl<'d> Unpin for PingManager<'d>

§

impl<'d> !UnwindSafe for PingManager<'d>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.