File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,18 @@ use capnp::serialize::{OwnedSegments, SegmentLengthsBuilder};
2828
2929use futures:: { AsyncRead , AsyncReadExt , AsyncWrite , AsyncWriteExt } ;
3030
31- #[ deprecated( since = "0.13.2" , note = "This function was renamed to try_read_message()" ) ]
32- pub async fn read_message < R > ( reader : R , options : message:: ReaderOptions ) -> Result < Option < message:: Reader < OwnedSegments > > >
33- where R : AsyncRead + Unpin
31+
32+ /// Asynchronously reads a message from `reader`.
33+ pub async fn read_message < R > ( reader : R , options : message:: ReaderOptions )
34+ -> Result < message:: Reader < OwnedSegments > >
35+ where R : AsyncRead + Unpin
3436{
35- try_read_message ( reader, options) . await
37+ match try_read_message ( reader, options) . await ? {
38+ Some ( s) => Ok ( s) ,
39+ None => Err ( Error :: failed ( "Premature end of file" . to_string ( ) ) )
40+ }
3641}
3742
38-
3943/// Asynchronously reads a message from `reader`. Returns `None` if `reader`
4044/// has zero bytes left (i.e. is at end-of-file). To read a stream
4145/// containing an unknown number of messages, you could call this function
You can’t perform that action at this time.
0 commit comments