Skip to content

Commit

Permalink
Add seekable method for TarReader use to determine whether the curren…
Browse files Browse the repository at this point in the history
…t reader supports seek

Signed-off-by: zyfjeff <[email protected]>
  • Loading branch information
zyfjeff committed Aug 29, 2023
1 parent cf6107b commit 61854cd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions builder/src/tarball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ impl Read for TarReader {
}
}

impl TarReader {
fn seekable(&self) -> bool {
matches!(
self,
TarReader::File(_) | TarReader::BufReaderInfoSeekable(_)
)
}
}

impl Seek for TarReader {
fn seek(&mut self, pos: SeekFrom) -> std::io::Result<u64> {
let seekable = self.seekable();
Expand Down

0 comments on commit 61854cd

Please sign in to comment.