Struct Package

Source
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

Source

pub fn new() -> Package

Create a new empty hpkg software archive representation

Source

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

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§

Source§

impl Clone for Package

Source§

fn clone(&self) -> Package

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Package

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Package

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.