Skip to main content

parse_dictionary

Function parse_dictionary 

Source
pub fn parse_dictionary(value: &[u8]) -> Result<Dictionary<'_>, ParseError>
Expand description

Parses a Dictionary with the default Limits (RFC 9651 section 4.2.2).

§Errors

As parse_list, and ErrorKind::InvalidKey.

§Examples

use parse_net::sfv::{self, BareItem, Member};

let d = sfv::parse_dictionary(b"a=1, a=2")?;
assert!(matches!(d.get("a"), Some(Member::Item(i)) if i.bare == BareItem::Integer(2)));