[−][src]Struct snmp_mp::VarBind
Represents a variable binding.
Examples
use snmp_mp::{ObjectIdent, VarBind, VarValue}; let name = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]); let var_bind = VarBind::new(name); assert_eq!(var_bind.value(), &VarValue::Unspecified);
Implementations
impl VarBind
[src]
pub fn new(name: ObjectIdent) -> Self
[src]
Constructs a new VarBind
with the passed ObjectIdent and a
value of VarValue::Unspecified.
Examples
let name = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]); let var_bind = VarBind::new(name); assert_eq!(var_bind.value(), &VarValue::Unspecified);
pub fn with_value(name: ObjectIdent, value: VarValue) -> Self
[src]
Constructs a new VarBind
with the passed ObjectIdent and
VarValue.
Examples
let name = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]); let value = VarValue::String(b"System description".to_vec()); let var_bind = VarBind::with_value(name, value); assert_eq!(var_bind.value(), &VarValue::String(b"System description".to_vec()));
pub fn name(&self) -> &ObjectIdent
[src]
Returns the variable name.
Examples
let name = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]); let var_bind = VarBind::new(name.clone()); assert_eq!(var_bind.name(), &name);
pub fn set_name(&mut self, name: ObjectIdent) -> &mut Self
[src]
Sets the variable name.
Examples
let name = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]); let mut var_bind = VarBind::new(name); let new_name = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01]); var_bind.set_name(new_name.clone()); assert_eq!(var_bind.name(), &new_name);
pub fn value(&self) -> &VarValue
[src]
Returns the variable value.
Examples
let name = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]); let var_bind = VarBind::new(name); assert_eq!(var_bind.value(), &VarValue::Unspecified);
pub fn set_value(&mut self, value: VarValue) -> &mut Self
[src]
Sets the variable value.
Examples
let name = ObjectIdent::from_slice(&[0x01, 0x03, 0x06, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00]); let mut var_bind = VarBind::new(name); let new_value = VarValue::NoSuchInstance; var_bind.set_value(new_value.clone()); assert_eq!(var_bind.value(), &new_value);
Trait Implementations
impl Clone for VarBind
[src]
impl Debug for VarBind
[src]
impl Eq for VarBind
[src]
impl Hash for VarBind
[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<VarBind> for VarBind
[src]
impl StructuralEq for VarBind
[src]
impl StructuralPartialEq for VarBind
[src]
Auto Trait Implementations
impl RefUnwindSafe for VarBind
impl Send for VarBind
impl Sync for VarBind
impl Unpin for VarBind
impl UnwindSafe for VarBind
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>,