codec: document UdpFramed decoder errors (#8248)

This commit is contained in:
Minh Vu
2026-07-06 13:44:17 +02:00
committed by GitHub
parent c637f6e73d
commit 962420a4f3
+6
View File
@@ -22,6 +22,12 @@ use std::{
/// handle encoding and decoding of messages frames. Note that the incoming and
/// outgoing frame types may be distinct.
///
/// A single datagram may decode into multiple frames. `UdpFramed` will keep
/// calling [`Decoder::decode_eof`] with the current datagram until it returns
/// `Ok(None)`. If a decoder wants to discard a malformed datagram and continue
/// receiving later datagrams, it should consume or clear the remaining bytes
/// from the buffer before returning `Err`.
///
/// This function returns a *single* object that is both [`Stream`] and [`Sink`];
/// grouping this into a single object is often useful for layering things which
/// require both read and write access to the underlying object.