refactor(libarchive): rename ArchiveFile to FileReader

main
Jef Roosens 2023-07-14 13:24:50 +02:00
parent 443a03c8f6
commit 2a6bd46661
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 7 additions and 7 deletions

View File

@ -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`

View File

@ -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 }
} }