Struct apt_pkg_native::Cache [] [src]

pub struct Cache { /* fields omitted */ }

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

Methods

impl Cache
[src]

[src]

Get a reference to the singleton.

[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.

[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.

[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.

[src]

Find a package by name and architecture.

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

[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]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Cache

impl Sync for Cache