[pbs-devel] [PATCH pxar] decoder: aio: Make `TokioReader` public
Max Carrara
m.carrara at proxmox.com
Fri Jul 21 17:58:19 CEST 2023
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 at proxmox.com>
---
src/decoder/aio.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/decoder/aio.rs b/src/decoder/aio.rs
index 200dd3d..e2166fe 100644
--- a/src/decoder/aio.rs
+++ b/src/decoder/aio.rs
@@ -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;
--
2.39.2
More information about the pbs-devel
mailing list