Skip to main content

try_decode_stream

Function try_decode_stream 

Source
pub async fn try_decode_stream(
    lines: impl IntoIterator<Item = String>,
    options: Option<DecodeStreamOptions>,
) -> Result<Vec<JsonStreamEvent>>
Expand description

Try to decode TOON lines into a stream of events asynchronously, returning a Result.

This is the fallible version of decode_stream. Use this when you want to handle decoding errors gracefully instead of panicking.

When the async-stream feature is enabled, this uses the asupersync runtime for true async streaming with cancellation support. Otherwise, it falls back to synchronous decoding wrapped in an async function.

ยงErrors

Returns an error if decoding fails due to malformed input or strict-mode validation errors.