Skip to content

Commit 0b7a999

Browse files
committed
add comments about the source of write_message() errors
1 parent f720c47 commit 0b7a999

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

capnp/src/serialize.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ fn flatten_segments<R: message::ReaderSegments + ?Sized>(segments: &R) -> Vec<u8
428428
///
429429
/// For optimal performance, `write` should be a buffered writer. `flush()` will not be called on
430430
/// the writer.
431+
///
432+
/// The only source of errors from this function are `write.write_all()` calls. If you pass in
433+
/// a writer that never returns an error, then this function will never return an error.
431434
pub fn write_message<W, A>(mut write: W, message: &message::Builder<A>) -> Result<()>
432435
where
433436
W: Write,

capnp/src/serialize_packed.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ where
402402
}
403403

404404
/// Writes a packed message to a stream.
405+
///
406+
/// The only source of errors from this function are `write.write_all()` calls. If you pass in
407+
/// a writer that never returns an error, then this function will never return an error.
405408
pub fn write_message<W, A>(write: W, message: &crate::message::Builder<A>) -> Result<()>
406409
where
407410
W: Write,

0 commit comments

Comments
 (0)