From 8307c708a3b7a650a723a4e942106567b1dc6b10 Mon Sep 17 00:00:00 2001 From: Tim Kuehn Date: Wed, 24 Feb 2016 20:32:15 -0800 Subject: [PATCH] Better documentation for Stream. Basically copied from TcpStream verbatim. --- tarpc/src/transport/mod.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tarpc/src/transport/mod.rs b/tarpc/src/transport/mod.rs index 98d9406..867c8b2 100644 --- a/tarpc/src/transport/mod.rs +++ b/tarpc/src/transport/mod.rs @@ -29,13 +29,27 @@ pub trait Listener: Send + 'static { /// A cloneable Reader/Writer. pub trait Stream: Read + Write + Send + Sized + 'static { - /// Clone that can fail. + /// Creates a new independently owned handle to the underlying socket. + /// + /// The returned TcpStream should reference the same stream that this + /// object references. Both handles should read and write the same + /// stream of data, and options set on one stream should be propagated + /// to the other stream. fn try_clone(&self) -> io::Result; /// Sets a read timeout. + /// + /// If the value specified is `None`, then read calls will block indefinitely. + /// It is an error to pass the zero `Duration` to this method. fn set_read_timeout(&self, dur: Option) -> io::Result<()>; /// Sets a write timeout. + /// + /// If the value specified is `None`, then write calls will block indefinitely. + /// It is an error to pass the zero `Duration` to this method. fn set_write_timeout(&self, dur: Option) -> io::Result<()>; /// Shuts down both ends of the stream. + /// + /// Implementations should cause all pending and future I/O on the specified + /// portions to return immediately with an appropriate value. fn shutdown(&self) -> io::Result<()>; }