pub fn read_oml_with(
text: &str,
limits: &Limits,
) -> Result<RawNode, OmnistError>Expand description
read_oml under explicit Limits.
Returns the Limits::validate error unchanged when the limits are out
of range. Otherwise a syntax error is an OmnistError::Parse as in
read_oml, and a limit crossed is an OmnistError::Document
(document.limit.depth / document.limit.nodes at $,
document.limit.int-digits at the path of the over-long integer).
use omnist::limits::Limits;
use omnist::oml::read_oml_with;
let limits = Limits::default().with_max_int_digits(3);
assert!(read_oml_with("n: 999\n", &limits).is_ok());
let err = read_oml_with("n: 1000\n", &limits).unwrap_err();
assert_eq!(err.to_string(), "$.n: integer literal exceeds the 3-digit limit (security: \
unbounded-digit int-to-str conversion is superlinear)");