/// Sends a single ICMP echo request from `source_realm` to `addr`, and waits
/// for the echo reply.
///
/// The body of the ICMP packet will be filled with `payload_length` 0 bytes.
/// Panics if the ping fails.
Sends a single ICMP echo request from `source_realm` to `addr`, and waits
for the echo reply.

The body of the ICMP packet will be filled with `payload_length` 0 bytes.
Panics if the ping fails.
Sends a single ICMP echo request from ` source_realm ` to ` addr ` and waits for the echo reply . The body of the ICMP packet will be filled with ` payload_length ` 0 bytes . Panics if the ping fails .
async fn expect_successful_ping<Ip: ping::IpExt>(
    source_realm: &netemul::TestRealm<'_>,
    addr: Ip::Addr,
    payload_length: usize,
) {
    let icmp_sock = source_realm.icmp_socket::<Ip>().await.expect("failed to create ICMP socket");
    let payload: Vec<u8> = vec![0; payload_length];
    let (mut sink, mut stream) = ping::new_unicast_sink_and_stream::<Ip, _, { u16::MAX as usize }>(
        &icmp_sock, &addr, &payload,
    );
    const SEQ: u16 = 1;
    sink.send(SEQ).await.expect("failed to send ping");
    let got = stream
        .try_next()
        .await
        .expect("echo reply failure")
        .expect("echo stream ended unexpectedly");
    assert_eq!(got, SEQ);
}
async fn expect_successful_ping < Ip : ping :: IpExt > ( source_realm : & netemul :: TestRealm < ' _ > , addr : Ip :: Addr , payload_length : usize , ) { let icmp_sock = source_realm . icmp_socket :: < Ip > ( ) . await . expect ( " " ) ; let payload : Vec < u8 > = vec ! [ 0 payload_length ] ; let ( mut sink , mut stream ) = ping :: new_unicast_sink_and_stream :: < Ip , _ , { u16 :: MAX as usize } > ( & icmp_sock , & addr , & payload , ) ; const SEQ : u16 = 1 ; sink . send ( SEQ ) . await . expect ( " " ) ; let got = stream . try_next ( ) . await . expect ( " " ) . expect ( " " ) ; assert_eq ! ( got SEQ ) ; }
Sends a single ICMP echo request from `source_realm` to `addr`, and waits
for the echo reply.
Sends a single ICMP echo request from ` source_realm ` to ` addr ` and waits for the echo reply .
source_realm
&netemul::TestRealm<'_>
addr
Ip::Addr
payload_length
usize