refactor(libarchive): rename ArchiveFile to FileReader
parent
443a03c8f6
commit
2a6bd46661
|
@ -1,4 +1,4 @@
|
||||||
use super::file::ArchiveFile;
|
use super::file::FileReader;
|
||||||
use crate::archive::{Handle, ReadCompression, ReadFilter, ReadFormat};
|
use crate::archive::{Handle, ReadCompression, ReadFilter, ReadFormat};
|
||||||
use crate::error::{ArchiveError, Result};
|
use crate::error::{ArchiveError, Result};
|
||||||
use crate::read::Archive;
|
use crate::read::Archive;
|
||||||
|
@ -119,9 +119,9 @@ impl Builder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Open a file with this builder, consuming it and returning a `FileReader`
|
/// Open a file with this builder, consuming it and returning a `FileReader`
|
||||||
pub fn open_file<T: AsRef<Path>>(self, file: T) -> Result<ArchiveFile> {
|
pub fn open_file<T: AsRef<Path>>(self, file: T) -> Result<FileReader> {
|
||||||
self.check_consumed()?;
|
self.check_consumed()?;
|
||||||
ArchiveFile::open(self, file)
|
FileReader::open(self, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Open a stream with this builder, consuming it and returning a `StreamReader`
|
/// Open a stream with this builder, consuming it and returning a `StreamReader`
|
||||||
|
|
|
@ -7,12 +7,12 @@ use std::path::Path;
|
||||||
|
|
||||||
const BLOCK_SIZE: usize = 10240;
|
const BLOCK_SIZE: usize = 10240;
|
||||||
|
|
||||||
pub struct ArchiveFile {
|
pub struct FileReader {
|
||||||
handle: *mut ffi::Struct_archive,
|
handle: *mut ffi::Struct_archive,
|
||||||
// entry: ReaderEntry,
|
// entry: ReaderEntry,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Handle for ArchiveFile {
|
impl Handle for FileReader {
|
||||||
unsafe fn handle(&self) -> *const ffi::Struct_archive {
|
unsafe fn handle(&self) -> *const ffi::Struct_archive {
|
||||||
self.handle as *const _
|
self.handle as *const _
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ impl Handle for ArchiveFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for ArchiveFile {
|
impl Drop for FileReader {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::archive_read_free(self.handle_mut());
|
ffi::archive_read_free(self.handle_mut());
|
||||||
|
@ -30,7 +30,7 @@ impl Drop for ArchiveFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Archive for ArchiveFile {
|
impl Archive for FileReader {
|
||||||
fn new(handle: *mut ffi::Struct_archive) -> Self {
|
fn new(handle: *mut ffi::Struct_archive) -> Self {
|
||||||
Self { handle }
|
Self { handle }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue