From: Dietmar Maurer Date: Fri, 18 Sep 2020 09:32:43 +0000 (+0200) Subject: Decoder>: allow access to input X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1568a7546d2e7dac911501295775a672e8b439e6;p=pxar.git Decoder>: allow access to input We need this to query the status of the input when decode fails. --- diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 3e84107..fcc2dd9 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -194,6 +194,10 @@ impl DecoderImpl { Self::new_full(input, "/".into()).await } + pub(crate) fn input(&self) -> &I { + &self.input + } + pub(crate) async fn new_full(input: I, path: PathBuf) -> io::Result { let this = DecoderImpl { input, diff --git a/src/decoder/sync.rs b/src/decoder/sync.rs index a7afda1..85b4865 100644 --- a/src/decoder/sync.rs +++ b/src/decoder/sync.rs @@ -28,6 +28,10 @@ impl Decoder> { pub fn from_std(input: T) -> io::Result { Decoder::new(StandardReader::new(input)) } + + pub fn input(&mut self) -> &T { + self.inner.input().inner() + } } impl Decoder> { @@ -95,6 +99,10 @@ impl StandardReader { pub fn new(inner: T) -> Self { Self { inner } } + + pub fn inner(&self) -> &T { + &self.inner + } } impl SeqRead for StandardReader {