pub struct Package<'a> { /* private fields */ }Expand description
A struct representing an apt Package
Implementations
sourceimpl<'a> Package<'a>
impl<'a> Package<'a>
pub fn new(
records: Rc<RefCell<Records>>,
depcache: Rc<RefCell<DepCache>>,
pkg_ptr: PackagePtr
) -> Package<'a>
sourcepub fn fullname(&self, pretty: bool) -> String
pub fn fullname(&self, pretty: bool) -> String
Get the fullname of the package.
Pretty is a bool that will omit the native arch.
For example on an amd64 system:
use rust_apt::cache::Cache;
let cache = Cache::new();
if let Some(pkg) = cache.get("apt") {
// Prints just "apt"
println!("{}", pkg.fullname(true));
// Prints "apt:amd64"
println!("{}", pkg.fullname(false));
};
if let Some(pkg) = cache.get("apt:i386") {
// Prints "apt:i386" for the i386 package
println!("{}", pkg.fullname(true));
};sourcepub fn current_state(&self) -> u8
pub fn current_state(&self) -> u8
The current state of the package.
sourcepub fn inst_state(&self) -> u8
pub fn inst_state(&self) -> u8
The installed state of the package.
sourcepub fn selected_state(&self) -> u8
pub fn selected_state(&self) -> u8
The selected state of the package.
sourcepub fn has_versions(&self) -> bool
pub fn has_versions(&self) -> bool
Check if the package has versions.
sourcepub fn has_provides(&self) -> bool
pub fn has_provides(&self) -> bool
Check if the package has provides.
sourcepub fn candidate(&self) -> Option<Version<'a>>
pub fn candidate(&self) -> Option<Version<'a>>
Returns the version object of the candidate.
If there isn’t a candidate, returns None
sourcepub fn installed(&self) -> Option<Version<'a>>
pub fn installed(&self) -> Option<Version<'a>>
Returns the version object of the installed version.
If there isn’t an installed version, returns None
sourcepub fn is_installed(&self) -> bool
pub fn is_installed(&self) -> bool
Check if the package is installed.
sourcepub fn is_upgradable(&self, skip_depcache: bool) -> bool
pub fn is_upgradable(&self, skip_depcache: bool) -> bool
Check if the package is upgradable.
skip_depcache = true increases performance by skipping the pkgDepCache
Skipping the depcache is very unnecessary if it’s already been
initialized If you’re not sure, set skip_depcache = false
sourcepub fn is_auto_installed(&self) -> bool
pub fn is_auto_installed(&self) -> bool
Check if the package is auto installed. (Not installed by the user)
sourcepub fn is_auto_removable(&self) -> bool
pub fn is_auto_removable(&self) -> bool
Check if the package is auto removable
sourcepub fn is_now_broken(&self) -> bool
pub fn is_now_broken(&self) -> bool
Check if the package is now broken
sourcepub fn is_inst_broken(&self) -> bool
pub fn is_inst_broken(&self) -> bool
Check if the package package installed is broken
sourcepub fn marked_install(&self) -> bool
pub fn marked_install(&self) -> bool
Check if the package is marked install
sourcepub fn marked_upgrade(&self) -> bool
pub fn marked_upgrade(&self) -> bool
Check if the package is marked upgrade
sourcepub fn marked_delete(&self) -> bool
pub fn marked_delete(&self) -> bool
Check if the package is marked delete
sourcepub fn marked_keep(&self) -> bool
pub fn marked_keep(&self) -> bool
Check if the package is marked keep
sourcepub fn marked_downgrade(&self) -> bool
pub fn marked_downgrade(&self) -> bool
Check if the package is marked downgrade
sourcepub fn marked_reinstall(&self) -> bool
pub fn marked_reinstall(&self) -> bool
Check if the package is marked reinstall
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Package<'a>
impl<'a> !Send for Package<'a>
impl<'a> !Sync for Package<'a>
impl<'a> !Unpin for Package<'a>
impl<'a> !UnwindSafe for Package<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more