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.