Skip to main content

decode_no_coerce_with_options

Function decode_no_coerce_with_options 

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

Decode without type coercion and with additional options.

ยงExamples

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

let options = DecodeOptions::new()
    .with_coerce_types(false)
    .with_strict(false);
let result: Value = decode_no_coerce_with_options("value: \"123\"", &options)?;
assert_eq!(result["value"], json!("123"));