|
|
|
@ -51,14 +51,22 @@ impl From<apt::APT_AppStatus> for AppStatus {
@@ -51,14 +51,22 @@ impl From<apt::APT_AppStatus> for AppStatus {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub struct Apt { |
|
|
|
|
pd: PhantomData<()>, |
|
|
|
|
pd: PhantomData<i32> |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl Apt { |
|
|
|
|
pub fn new() -> Apt { |
|
|
|
|
Apt { pd: PhantomData } |
|
|
|
|
pub fn new() -> Result<Apt, i32> { |
|
|
|
|
unsafe { |
|
|
|
|
let r = apt::aptInit(); |
|
|
|
|
if r < 0 { |
|
|
|
|
Err(r) |
|
|
|
|
} else { |
|
|
|
|
Ok(Apt { pd: PhantomData }) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_status(&self) -> AppStatus { |
|
|
|
|
unsafe { apt::aptGetStatus().into() } |
|
|
|
|
} |
|
|
|
@ -88,3 +96,9 @@ impl Apt {
@@ -88,3 +96,9 @@ impl Apt {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl Drop for Apt { |
|
|
|
|
fn drop(&mut self) { |
|
|
|
|
unsafe { apt::aptExit() }; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|