Deb

Struct Deb 

Source
pub struct Deb {
    pub extracted_path: Option<String>,
    /* private fields */
}
Expand description

This is the struct that should be used to parse .deb files. It should first be created with Deb::new and then extracted with Deb::extract. Once the file has been extracted you can then retrieve data from it.

Example

use std::io::Error;
use deb_rs::file::Deb;

fn main() -> Result<(), Error> {
  let mut deb = Deb::new("./example/assets/gnome_clocks.deb");
  deb.extract()?;

  deb.version()?; // Returns the version of the structure of the debian package.
  // NOTE: extract() will fail with versions that are not 2.0 as their structure is different

  deb.retrieve_control()?; // Will return some general information about the contents of the package

   deb.install_tree()?; // Returns an array of files that must be moved for the file package to work

   Ok(())
}

Fields§

§extracted_path: Option<String>

Implementations§

Source§

impl Deb

@todo Add support for prerm and postinst files

Source

pub fn new(path: &'static str) -> Self

Source

pub fn extract(&mut self) -> Result<&mut Self, Error>

Extracts the deb file into a set of individual files

Source

pub fn version(&self) -> Result<Version, Error>

Returns the version of the deb file. Note that the standard has been V2_0 (2.0) since debian 0.93

Source

pub fn install_tree(&self) -> Result<Vec<PathItem>, Error>

@todo Docs for this function

Source

pub fn retrieve_control(&self) -> Result<Control, Error>

@todo Docs for this function

Auto Trait Implementations§

§

impl Freeze for Deb

§

impl RefUnwindSafe for Deb

§

impl Send for Deb

§

impl Sync for Deb

§

impl Unpin for Deb

§

impl UnwindSafe for Deb

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> 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V