pub enum Message {
Community(CommunityMessage),
V3(V3Message),
}Expand description
Decoded SNMP message (any version).
This enum provides a unified interface for working with SNMP messages
regardless of version. Use Message::decode to parse incoming data.
Variants§
Community(CommunityMessage)
SNMPv1 or SNMPv2c message with community string
V3(V3Message)
SNMPv3 message with USM security
Implementations§
Source§impl Message
impl Message
Sourcepub fn pdu(&self) -> &Pdu
pub fn pdu(&self) -> &Pdu
Get a reference to the PDU.
For V3 messages with encrypted data, this will panic.
Use try_pdu() for a fallible version.
Sourcepub fn try_pdu(&self) -> Option<&Pdu>
pub fn try_pdu(&self) -> Option<&Pdu>
Try to get a reference to the PDU.
Returns None for encrypted V3 messages.
Sourcepub fn into_pdu(self) -> Pdu
pub fn into_pdu(self) -> Pdu
Consume and return the PDU.
For V3 messages with encrypted data, this will panic.
Use try_into_pdu() for a fallible version.
Sourcepub fn try_into_pdu(self) -> Option<Pdu>
pub fn try_into_pdu(self) -> Option<Pdu>
Try to consume and return the PDU.
Returns None for encrypted V3 messages.
Trait Implementations§
Source§impl From<CommunityMessage> for Message
impl From<CommunityMessage> for Message
Source§fn from(msg: CommunityMessage) -> Self
fn from(msg: CommunityMessage) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more