You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior of serde_json::from_reader is that it expects the input stream to end after the deserialized object. If the stream contains trailing data, that is considered an error. If the stream does not end, such as in the case of a persistent socket connection, then from_reader would not return. This is the correct behavior for from_reader for example when deserializing from a File, in which we don't want to silently allow trailing garbage. It is possible instead to deserialize from a prefix of an input stream without looking for EOF by managing your own Deserializer:
letmut de = serde_json::Deserializer::from_reader(stream);let t = T::deserialize(&mut de)?;
The text was updated successfully, but these errors were encountered:
The behavior of serde_json::from_reader is that it expects the input stream to end after the deserialized object. If the stream contains trailing data, that is considered an error. If the stream does not end, such as in the case of a persistent socket connection, then from_reader would not return. This is the correct behavior for from_reader for example when deserializing from a File, in which we don't want to silently allow trailing garbage. It is possible instead to deserialize from a prefix of an input stream without looking for EOF by managing your own Deserializer:
The text was updated successfully, but these errors were encountered: