embassy-net

Crates

git

Versions

default

Flavors

Struct PingParams

Source
pub struct PingParams<'a> { /* private fields */ }
Expand description

Parameters for configuring the ping operation.

This struct provides various configuration options for performing ICMP ping operations, including the target IP address, payload data, hop limit, number of pings, and timeout duration.

§Fields

  • target - The target IP address for the ping operation.
  • source - The source IP address for the ping operation (IPv6 only).
  • payload - The data to be sent in the payload field of the ping.
  • hop_limit - The hop limit to be used by the socket.
  • count - The number of pings to be sent in one ping operation.
  • timeout - The timeout duration before returning a PingError::DestinationHostUnreachable error.
  • rate_limit - The minimum time per echo request.

Implementations§

Source§

impl<'a> PingParams<'a>

Source

pub fn new<T: Into<IpAddr>>(target: T) -> Self

Creates a new instance of PingParams with the specified target IP address.

Source

pub fn set_target<T: Into<IpAddr>>(&mut self, target: T) -> &mut Self

Sets the target IP address for the ping.

Source

pub fn target(&self) -> Option<IpAddr>

Retrieves the target IP address for the ping.

Source

pub fn set_source<T: Into<Ipv6Address>>(&mut self, source: T) -> &mut Self

Sets the source IP address for the ping (IPv6 only).

Source

pub fn source(&self) -> Option<Ipv6Addr>

Retrieves the source IP address for the ping (IPv6 only).

Source

pub fn set_payload(&mut self, payload: &'a [u8]) -> &mut Self

Sets the data used in the payload field of the ping with the provided slice.

Source

pub fn payload(&self) -> &'a [u8]

Gives a reference to the slice of data that’s going to be sent in the payload field of the ping.

Source

pub fn set_hop_limit(&mut self, hop_limit: Option<u8>) -> &mut Self

Sets the hop limit that will be used by the socket with set_hop_limit().

Note: A hop limit of Some(0) is equivalent to a hop limit of None.

Source

pub fn hop_limit(&self) -> Option<u8>

Retrieves the hop limit that will be used by the socket with set_hop_limit().

Source

pub fn set_count(&mut self, count: u16) -> &mut Self

Sets the count used for specifying the number of pings done on one ping() call.

Note: A count of 0 will be set as 1.

Source

pub fn count(&self) -> u16

Retrieve the count used for specifying the number of pings done on one ping() call.

Source

pub fn set_timeout(&mut self, timeout: Duration) -> &mut Self

Sets the timeout used before returning PingError::DestinationHostUnreachable when waiting for the Echo Reply icmp packet.

Source

pub fn timeout(&self) -> Duration

Retrieve the timeout used before returning PingError::DestinationHostUnreachable when waiting for the Echo Reply icmp packet.

Source

pub fn set_rate_limit(&mut self, rate_limit: Duration) -> &mut Self

Sets the rate_limit: minimum time per echo request.

Source

pub fn rate_limit(&self) -> Duration

Retrieve the rate_limit.

Trait Implementations§

Source§

impl Default for PingParams<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PingParams<'a>

§

impl<'a> RefUnwindSafe for PingParams<'a>

§

impl<'a> Send for PingParams<'a>

§

impl<'a> Sync for PingParams<'a>

§

impl<'a> Unpin for PingParams<'a>

§

impl<'a> UnwindSafe for PingParams<'a>

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.