Skip to main content

parse_object_with

Function parse_object_with 

Source
pub fn parse_object_with(input: &[u8], limits: &Limits) -> Result<Object>
Expand description

parse_object with explicit limits.

§Errors

As parse_object.

§Examples

use laminapdf_syntax::{Error, Limit, Limits, parse_object_with};
let shallow = Limits::default().with_max_nesting_depth(1);
assert!(parse_object_with(b"[1]", &shallow).is_ok());
assert!(matches!(
    parse_object_with(b"[[1]]", &shallow),
    Err(Error::LimitExceeded { limit: Limit::NestingDepth, .. })
));

Added in 0.2.0.