Skip to main content

from_str_escaped

Function from_str_escaped 

Source
pub fn from_str_escaped<'de, T>(
    flavor: Flavor,
    input: &'de str,
    unescape: &'de mut [u8],
) -> Result<T, Located<'de, Error>>
where T: Deserialize<'de>,
Expand description

Deserialize a value from a string, and handle escaped strings.

This is a convenience function to deserialize a value with some sensible defaults. In particular, this uses a fixed recursion depth of 64. If you are getting a MaxRecursion error, please use Deserializer directly.

This uses unescape as a scratch buffer to remove escapes from strings and bytes. If this buffer runs out of space, this function returns UnescapeBufferFull. Consider using a larger buffer, or using Escaped.

For deserializing from bytes, see from_slice_escaped.