[−][src]Enum snmp_mp::ScopedPduData
Represents either the plaintext scoped PDU if the privacy flag is not set, or it represents an encrypted PDU encoded as a byte string.
Examples
use snmp_mp::{ScopedPdu, ScopedPduData}; let scoped_pdu_data = ScopedPduData::Plaintext(ScopedPdu::new(1)); let scoped_pdu = scoped_pdu_data.plaintext(); assert_eq!(scoped_pdu.unwrap(), &ScopedPdu::new(1));
Variants
Plaintext(ScopedPdu)
Plaintext scoped PDU.
Encrypted PDU as a byte string.
Implementations
impl ScopedPduData
[src]
pub fn plaintext(&self) -> Option<&ScopedPdu>
[src]
Returns a reference to the plaintext scoped PDU, or None
if the scoped PDU is encrypted.
Examples
let scoped_pdu_data = ScopedPduData::Plaintext(ScopedPdu::new(1)); let scoped_pdu = scoped_pdu_data.plaintext(); assert_eq!(scoped_pdu.unwrap(), &ScopedPdu::new(1));
pub fn plaintext_mut(&mut self) -> Option<&mut ScopedPdu>
[src]
Returns a mutable reference to the plaintext scoped PDU, or None
if the scoped PDU is
encrypted.
Examples
let mut scoped_pdu_data = ScopedPduData::Plaintext(ScopedPdu::new(1)); let scoped_pdu = scoped_pdu_data.plaintext_mut().unwrap(); scoped_pdu.set_request_id(1234); assert_eq!(scoped_pdu.request_id(), 1234);
pub fn encrypted(&self) -> Option<&[u8]>
[src]
Returns a reference to the encrypted scoped PDU, or None
if the scoped PDU is plaintext.
Examples
let scoped_pdu_data = ScopedPduData::Encrypted(encrypted_scoped_pdu.clone()); let optional_encrypted_scoped_pdu = scoped_pdu_data.encrypted(); assert_eq!(optional_encrypted_scoped_pdu.unwrap(), &encrypted_scoped_pdu[..]);
Trait Implementations
impl Clone for ScopedPduData
[src]
fn clone(&self) -> ScopedPduData
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ScopedPduData
[src]
impl Default for ScopedPduData
[src]
impl Eq for ScopedPduData
[src]
impl Hash for ScopedPduData
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<ScopedPduData> for ScopedPduData
[src]
fn eq(&self, other: &ScopedPduData) -> bool
[src]
fn ne(&self, other: &ScopedPduData) -> bool
[src]
impl StructuralEq for ScopedPduData
[src]
impl StructuralPartialEq for ScopedPduData
[src]
Auto Trait Implementations
impl RefUnwindSafe for ScopedPduData
impl Send for ScopedPduData
impl Sync for ScopedPduData
impl Unpin for ScopedPduData
impl UnwindSafe for ScopedPduData
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,