From ed2dbe271db724512537bd6d8e5c0042cffe0f2a Mon Sep 17 00:00:00 2001 From: Nikita Vilunov Date: Thu, 2 Mar 2023 01:15:24 +0100 Subject: [PATCH] Make read_event_into_async an async-fn --- src/reader/async_tokio.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/reader/async_tokio.rs b/src/reader/async_tokio.rs index ba8ef70a..4f1ceb6f 100644 --- a/src/reader/async_tokio.rs +++ b/src/reader/async_tokio.rs @@ -81,19 +81,17 @@ impl Reader { /// ``` /// /// [`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, - ) -> Pin>> + 'reader>> { - Box::pin(async move { - read_event_impl!( - self, buf, - TokioAdapter(&mut self.reader), - read_until_open_async, - read_until_close_async, - await - ) - }) + ) -> Result> { + 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()`].