#[non_exhaustive]pub enum JsonValidatedLimit {
ValueAndKeyNodes,
EncodedStringBytes,
}Expand description
Identifies an additional per-document decode limit for validated JSON.
The decoder reports this value in
JsonValidatedDecodeError::Limit
when a configured value or encoded-string bound is exceeded.
§Examples
use std::convert::Infallible;
use qubit_json::decode::JsonDecoder;
use qubit_json::decode::JsonNumberPolicy;
use qubit_json::decode::JsonValidatedDecodeError;
use qubit_json::decode::JsonValidatedDecodeOptions;
use qubit_json::decode::JsonValidatedLimit;
let options = JsonValidatedDecodeOptions::builder()
.max_value_and_key_nodes(2)
.build();
let error = JsonDecoder::unlimited()
.decode_unique_validated_str("{\"key\":1}", &options, |_, _| {
Ok::<_, Infallible>(JsonNumberPolicy::Preserve)
})
.expect_err("the object, key, and value exceed the two-node limit");
assert!(matches!(
error,
JsonValidatedDecodeError::Limit {
limit: JsonValidatedLimit::ValueAndKeyNodes,
..
}
));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ValueAndKeyNodes
Value entries plus decoded object-key entries.
EncodedStringBytes
Source bytes inside one encoded string token, excluding quotes.
Trait Implementations§
Source§impl Clone for JsonValidatedLimit
impl Clone for JsonValidatedLimit
impl Copy for JsonValidatedLimit
Source§impl Debug for JsonValidatedLimit
impl Debug for JsonValidatedLimit
impl Eq for JsonValidatedLimit
Source§impl Hash for JsonValidatedLimit
impl Hash for JsonValidatedLimit
Source§impl PartialEq for JsonValidatedLimit
impl PartialEq for JsonValidatedLimit
impl StructuralPartialEq for JsonValidatedLimit
Auto Trait Implementations§
impl Forget for JsonValidatedLimit
impl Freeze for JsonValidatedLimit
impl Move for JsonValidatedLimit
impl RefUnwindSafe for JsonValidatedLimit
impl Send for JsonValidatedLimit
impl Sync for JsonValidatedLimit
impl Unpin for JsonValidatedLimit
impl UnsafeUnpin for JsonValidatedLimit
impl UnwindSafe for JsonValidatedLimit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more