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};
28
28
29
29
use futures:: { AsyncRead , AsyncReadExt , AsyncWrite , AsyncWriteExt } ;
30
30
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
34
36
{
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
+ }
36
41
}
37
42
38
-
39
43
/// Asynchronously reads a message from `reader`. Returns `None` if `reader`
40
44
/// has zero bytes left (i.e. is at end-of-file). To read a stream
41
45
/// containing an unknown number of messages, you could call this function
You can’t perform that action at this time.
0 commit comments