Function next_json

Source
pub async fn next_json<T: DeserializeOwned>(recv: &mut RecvStream) -> Result<T>
Expand description

Reads a newline-terminated JSON message from a stream.

Reads bytes until a newline character is encountered, then deserializes the buffer as JSON into the specified type.

ยงErrors

Returns an error if:

  • Connection is closed while reading
  • JSON deserialization fails