feat: start of pkg info parsing code
This commit is contained in:
parent
2e118d0283
commit
7be4d83ca3
5 changed files with 178 additions and 0 deletions
|
|
@ -2,4 +2,8 @@ pub mod archive;
|
|||
pub mod error;
|
||||
pub mod read;
|
||||
|
||||
pub use archive::{
|
||||
Entry, ExtractOption, ExtractOptions, Handle, ReadCompression, ReadFilter, ReadFormat,
|
||||
WriteFilter, WriteFormat,
|
||||
};
|
||||
pub use error::Result;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ mod file;
|
|||
pub use builder::Builder;
|
||||
|
||||
use crate::archive::Handle;
|
||||
use crate::ReadFilter;
|
||||
use entries::Entries;
|
||||
use libarchive3_sys::ffi;
|
||||
use std::path::Path;
|
||||
|
|
@ -18,4 +19,13 @@ pub trait Archive: Handle + Sized {
|
|||
fn entries<'a>(&'a mut self) -> Entries<'a, Self> {
|
||||
Entries::new(self)
|
||||
}
|
||||
|
||||
fn filter(&mut self, index: i32) -> ReadFilter {
|
||||
let res = unsafe { ffi::archive_filter_code(self.handle_mut(), index) };
|
||||
|
||||
match res {
|
||||
0 => ReadFilter::None,
|
||||
_ => panic!("Unknown filter type"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue