Module hints

Module hints 

Source
Expand description

Pre-defined DISPLAY-HINT constants for common SNMP types.

These constants can be used with Value::format_with_hint() to format values according to their MIB definitions without looking up hints.

§Example

use async_snmp::format::hints;
use async_snmp::Value;
use bytes::Bytes;

let mac = Value::OctetString(Bytes::from_static(&[0x00, 0x1a, 0x2b, 0x3c, 0x4d, 0x5e]));
assert_eq!(mac.format_with_hint(hints::MAC_ADDRESS), Some("00:1a:2b:3c:4d:5e".to_string()));

Constants§

BINARY_STRING
Octet string as binary bits: “1b” - each byte as 8 binary digits.
DATE_AND_TIME
Date and time: “2d-1d-1d,1d:1d:1d.1d,1a1d:1d”.
DECIMAL_1
Integer with 1 decimal place: “d-1”.
DECIMAL_2
Integer with 2 decimal places: “d-2”.
DECIMAL_3
Integer with 3 decimal places: “d-3”.
DISPLAY_STRING
Display string (UTF-8): “255a” - up to 255 ASCII/UTF-8 characters.
DOTTED_DECIMAL
Dotted decimal: “1d.” - each byte as decimal separated by dots.
HEX_STRING
Hexadecimal string: “1x” - each byte as two hex digits.
HEX_STRING_SPACED
Hexadecimal with spaces: “1x “ - each byte as hex separated by spaces.
INTEGER_HEX
Integer as hex: “x” - integer value in lowercase hexadecimal.
MAC_ADDRESS
MAC address: “1x:” - each byte as hex separated by colons.
UTF8_STRING
UTF-8 string: “255t” - up to 255 UTF-8 encoded characters.