smoltcp/wire/
icmp.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#[cfg(feature = "proto-ipv4")]
use crate::wire::icmpv4;
#[cfg(feature = "proto-ipv6")]
use crate::wire::icmpv6;

#[derive(Clone, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Repr<'a> {
    #[cfg(feature = "proto-ipv4")]
    Ipv4(icmpv4::Repr<'a>),
    #[cfg(feature = "proto-ipv6")]
    Ipv6(icmpv6::Repr<'a>),
}
#[cfg(feature = "proto-ipv4")]
impl<'a> From<icmpv4::Repr<'a>> for Repr<'a> {
    fn from(s: icmpv4::Repr<'a>) -> Self {
        Repr::Ipv4(s)
    }
}
#[cfg(feature = "proto-ipv6")]
impl<'a> From<icmpv6::Repr<'a>> for Repr<'a> {
    fn from(s: icmpv6::Repr<'a>) -> Self {
        Repr::Ipv6(s)
    }
}