[][src]Struct apt_pkg_native::Cache

pub struct Cache { /* fields omitted */ }

A reference to the package cache singleton, from which most functionality can be accessed.

Methods

impl Cache[src]

pub fn get_singleton() -> Cache[src]

Get a reference to the singleton.

pub fn reload(&mut self)[src]

Drop the cache, and re-create it from scratch.

It's super important that there are no other outstanding references to the cache at this point. Again, I remind you not to try and outsmart the borrow checker. It doesn't know how much trouble there is in here.

pub fn iter(&mut self) -> CIterator<PkgIterator>[src]

Walk through all of the packages, in a random order.

If there are multiple architectures, multiple architectures will be returned.

See the module documentation for apologies about how this isn't an iterator.

pub fn find_by_name(&mut self, name: &str) -> CIterator<PkgIterator>[src]

Find a package by name. It's not clear whether this picks a random arch, or the primary one.

The returned iterator will either be at the end, or at a package with the name.

pub fn find_by_name_arch(
    &mut self,
    name: &str,
    arch: &str
) -> CIterator<PkgIterator>
[src]

Find a package by name and architecture.

The returned iterator will either be at the end, or at a matching package.

pub fn compare_versions(&self, left: &str, right: &str) -> Ordering[src]

Compare two versions, returning an Ordering, as used by most Rusty sort() methods.

This uses the "versioning scheme" currently set, which, in theory, can change, but in practice is always the "Standard .deb" scheme. As of 2017, there aren't even any other implementations. As such, this may eventually become a static method somewhere.

Examples

let mut packages = vec!["3.0", "3.1", "3.0~1"];
packages.sort_by(|left, right| cache.compare_versions(left, right));
assert_eq!(vec!["3.0~1", "3.0", "3.1"], packages);

Trait Implementations

impl Debug for Cache[src]

Auto Trait Implementations

impl RefUnwindSafe for Cache

impl Send for Cache

impl Sync for Cache

impl Unpin for Cache

impl UnwindSafe for Cache

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.