Skip to content

Commit

Permalink
Make read_event_into_async an async-fn
Browse files Browse the repository at this point in the history
  • Loading branch information
vilunov committed Mar 2, 2023
1 parent 25dbd53 commit ed2dbe2
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/reader/async_tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,17 @@ impl<R: AsyncBufRead + Unpin> Reader<R> {
/// ```
///
/// [`read_event_into()`]: Reader::read_event_into
pub fn read_event_into_async<'reader, 'b: 'reader>(
pub async fn read_event_into_async<'reader, 'b: 'reader>(
&'reader mut self,
buf: &'b mut Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<Event<'b>>> + 'reader>> {
Box::pin(async move {
read_event_impl!(
self, buf,
TokioAdapter(&mut self.reader),
read_until_open_async,
read_until_close_async,
await
)
})
) -> Result<Event<'b>> {
read_event_impl!(
self, buf,
TokioAdapter(&mut self.reader),
read_until_open_async,
read_until_close_async,
await
)
}

/// An asynchronous version of [`read_to_end_into()`].
Expand Down

0 comments on commit ed2dbe2

Please sign in to comment.