Skip to main content

from_async_reader_with_config

Function from_async_reader_with_config 

Source
pub async fn from_async_reader_with_config<R, T>(
    reader: &mut R,
    config: &ParserConfig,
) -> Result<T>
where R: AsyncRead + Unpin, T: DeserializeOwned + 'static,
Expand description

from_async_reader with a caller-supplied ParserConfig.

The reader probes at most one byte beyond ParserConfig::max_document_length via [tokio::io::AsyncReadExt::take] so a slow-drip adversary cannot drive the in-memory buffer beyond the configured limit.

ยงErrors

Returns the underlying Error from either the I/O drain or the parse step. An input larger than max_document_length returns Error::Io with std::io::ErrorKind::InvalidData; a truncated prefix is never parsed as a complete document.