Skip to main content

parse_object

Function parse_object 

Source
pub fn parse_object(input: &[u8]) -> Result<Object>
Expand description

Parses a single direct object from input with the default Limits. Trailing white-space and comments are allowed; anything else after the object is an error.

§Errors

Returns an error on malformed syntax, truncation, or a hard limit exceeded (Limits::max_nesting_depth, Limits::max_string_length).

§Examples

use laminapdf_syntax::{parse_object, Object};
let obj = parse_object(b"<< /Kids [3 0 R] /Count 1 >>")?;
assert_eq!(obj.as_dict().and_then(|d| d.get_int("Count")), Some(1));

Added in 0.2.0.