simplify pxar module structure

This commit is contained in:
Dietmar Maurer
2019-03-15 08:24:32 +01:00
parent 1ef46b81d3
commit 3dbfe5b142
6 changed files with 22 additions and 18 deletions

View File

@ -22,14 +22,14 @@ use nix::errno::Errno;
use nix::NixPath;
// This one need Read, but works without Seek
pub struct PxarDecoder<'a, R: Read> {
pub struct SequentialDecoder<'a, R: Read> {
reader: &'a mut R,
skip_buffer: Vec<u8>,
}
const HEADER_SIZE: u64 = std::mem::size_of::<CaFormatHeader>() as u64;
impl <'a, R: Read> PxarDecoder<'a, R> {
impl <'a, R: Read> SequentialDecoder<'a, R> {
pub fn new(reader: &'a mut R) -> Self {
let skip_buffer = vec![0u8; 64*1024];

View File

@ -27,7 +27,7 @@ use nix::sys::stat::FileStat;
/// maximum memory usage.
pub const MAX_DIRECTORY_ENTRIES: usize = 256*1024;
pub struct PxarEncoder<'a, W: Write> {
pub struct Encoder<'a, W: Write> {
current_path: PathBuf, // used for error reporting
writer: &'a mut W,
writer_pos: usize,
@ -38,7 +38,7 @@ pub struct PxarEncoder<'a, W: Write> {
verbose: bool,
}
impl <'a, W: Write> PxarEncoder<'a, W> {
impl <'a, W: Write> Encoder<'a, W> {
pub fn encode(
path: PathBuf,