]> git.proxmox.com Git - pxar.git/commitdiff
decoder: aio: Make `TokioReader` public
authorMax Carrara <m.carrara@proxmox.com>
Fri, 21 Jul 2023 15:58:19 +0000 (17:58 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 4 Aug 2023 11:09:09 +0000 (13:09 +0200)
This exposes `decoder::aio::TokioReader<T>` in a similar manner to
`decoder::sync::StandardReader<T>`, which is necessary if one wants
to remain generic over `T: tokio::io::AsyncRead`, e.g.:

> struct FooDecoder<T: tokio::io::AsyncRead> {
>    decoder: aio::Decoder<aio::TokioReader<T>>,
> }

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
src/decoder/aio.rs

index 200dd3dd1189676cb89c20a2e0daf89878e9bf1a..e2166fee8cb7204abcf40aed44c107de062190a1 100644 (file)
@@ -85,6 +85,7 @@ mod tok {
     }
 
     impl<T: tokio::io::AsyncRead> TokioReader<T> {
+        /// Create a new [TokioReader] from a type that implements [AsyncRead](tokio::io::AsyncRead).
         pub fn new(inner: T) -> Self {
             Self { inner }
         }
@@ -130,4 +131,4 @@ mod tok {
 }
 
 #[cfg(feature = "tokio-io")]
-use tok::TokioReader;
+pub use tok::TokioReader;