pub struct Package {Show 13 fields
pub filename: Option<PathBuf>,
pub header: Option<PackageHeaderV2>,
pub name: Option<String>,
pub summary: Option<String>,
pub description: Option<String>,
pub vendor: Option<String>,
pub packager: Option<String>,
pub basepackage: Option<i32>,
pub checksum: Option<String>,
pub installpath: Option<String>,
pub flags: u32,
pub architecture: Option<String>,
pub heap_data: Vec<Vec<u8>>,
/* private fields */
}
Expand description
Representation of a hpkg software archive
Fields§
§filename: Option<PathBuf>
§header: Option<PackageHeaderV2>
§name: Option<String>
§summary: Option<String>
§description: Option<String>
§vendor: Option<String>
§packager: Option<String>
§basepackage: Option<i32>
§checksum: Option<String>
§installpath: Option<String>
§flags: u32
§architecture: Option<String>
§heap_data: Vec<Vec<u8>>
Uncompressed heap data
Implementations§
Source§impl Package
impl Package
Sourcepub fn dump_raw_heap<P: AsRef<Path>>(
&mut self,
prefix: P,
) -> Result<usize, Box<dyn Error>>
pub fn dump_raw_heap<P: AsRef<Path>>( &mut self, prefix: P, ) -> Result<usize, Box<dyn Error>>
Examples found in repository?
examples/dump_hpkg.rs (line 25)
6fn main() {
7 let args: Vec<String> = env::args().collect();
8 if args.len() != 2 {
9 println!("usage: hpkg_dump <package.hpkg>");
10 process::exit(1);
11 }
12
13 let mut hpkg = match Package::load(&args[1]) {
14 Ok(o) => o,
15 Err(e) => {
16 println!("ERROR: {:?}", e);
17 assert!(false);
18 return;
19 },
20 };
21 println!("{:?}", hpkg);
22
23 let temp_directory = env::temp_dir();
24 println!("Dumping hpkg heap to {}/heap-chunk-N.data...", temp_directory.display());
25 match hpkg.dump_raw_heap(temp_directory) {
26 Ok(_) => (),
27 Err(e) => {
28 println!("Error: {}", e);
29 }
30 }
31}
Sourcepub fn load<P: AsRef<Path>>(hpkg_file: P) -> Result<Package, Box<dyn Error>>
pub fn load<P: AsRef<Path>>(hpkg_file: P) -> Result<Package, Box<dyn Error>>
Section start calculated as endOffset - section length Attributes Section = uncompressed heap size - attributes section length TOC Section = Attributes Section offset - toc section length Open an hpkg file produce a populated Package representation
Examples found in repository?
examples/dump_hpkg.rs (line 13)
6fn main() {
7 let args: Vec<String> = env::args().collect();
8 if args.len() != 2 {
9 println!("usage: hpkg_dump <package.hpkg>");
10 process::exit(1);
11 }
12
13 let mut hpkg = match Package::load(&args[1]) {
14 Ok(o) => o,
15 Err(e) => {
16 println!("ERROR: {:?}", e);
17 assert!(false);
18 return;
19 },
20 };
21 println!("{:?}", hpkg);
22
23 let temp_directory = env::temp_dir();
24 println!("Dumping hpkg heap to {}/heap-chunk-N.data...", temp_directory.display());
25 match hpkg.dump_raw_heap(temp_directory) {
26 Ok(_) => (),
27 Err(e) => {
28 println!("Error: {}", e);
29 }
30 }
31}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnwindSafe for Package
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more