Skip to main content

decode_strict_with_options

Function decode_strict_with_options 

Source
pub fn decode_strict_with_options<T>(
    input: &str,
    options: &DecodeOptions,
) -> Result<T, ToonError>
Expand description

Decode with strict validation and additional options.

ยงExamples

use serde_json::{
    json,
    Value,
};
use toon_format::{
    decode_strict_with_options,
    DecodeOptions,
};

let options = DecodeOptions::new()
    .with_strict(true)
    .with_delimiter(toon_format::Delimiter::Pipe);
let result: Value = decode_strict_with_options("items[2|]: a|b", &options)?;
assert_eq!(result["items"], json!(["a", "b"]));