Skip to main content

with_deserializer_from_str_with_options

Function with_deserializer_from_str_with_options 

Source
pub fn with_deserializer_from_str_with_options<'de, R, F>(
    input: &'de str,
    options: Options,
    f: F,
) -> Result<R, Error>
where for<'e> F: FnOnce(Deserializer<'de, 'e>) -> Result<R, Error>,
Expand description

Create a streaming crate::Deserializer for a YAML string and run a closure against it.

This is useful for tooling that needs access to the underlying Serde deserializer, such as wrappers that report unknown/ignored fields (e.g. the serde_ignored crate) or wrappers that augment error paths.

The deserializer borrows internal parsing state, so it cannot be returned directly. Instead, you provide a closure f that performs the desired deserialization.