pub trait IcmpMessage<I: IcmpIpExt>:
Sized
+ Copy
+ FromBytes
+ IntoBytes
+ KnownLayout
+ Immutable
+ Unaligned {
type Code: Into<u8> + Copy + Debug;
type Body<B: SplitByteSlice>: MessageBody<B = B>;
const TYPE: I::IcmpMessageType;
const EXPECTS_BODY: bool = true;
// Required method
fn code_from_u8(code: u8) -> Option<Self::Code>;
}
Expand description
An ICMP message.
Required Associated Constants§
Sourceconst TYPE: I::IcmpMessageType
const TYPE: I::IcmpMessageType
The type corresponding to this message type.
The value of the “type” field in the ICMP header corresponding to messages of this type.
Provided Associated Constants§
Sourceconst EXPECTS_BODY: bool = true
const EXPECTS_BODY: bool = true
Whether or not a message body is expected in an ICMP packet.
Required Associated Types§
Sourcetype Code: Into<u8> + Copy + Debug
type Code: Into<u8> + Copy + Debug
The type of codes used with this message.
The ICMP header includes an 8-bit “code” field. For a given message type, different values of this field carry different meanings. Not all code values are used - some may be invalid. This type represents a parsed code. For example, for TODO, it is the TODO type.
Sourcetype Body<B: SplitByteSlice>: MessageBody<B = B>
type Body<B: SplitByteSlice>: MessageBody<B = B>
The type of the body used with this message.
Required Methods§
Sourcefn code_from_u8(code: u8) -> Option<Self::Code>
fn code_from_u8(code: u8) -> Option<Self::Code>
Parse a Code
from an 8-bit number.
Parse a Code
from the 8-bit “code” field in the ICMP header. Not all
values for this field are valid. If an invalid value is passed,
code_from_u8
returns None
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.