[][src]Struct aur_depends::Resolver

pub struct Resolver<'a, H: Raur = Handle> { /* fields omitted */ }

Resolver is the main type for resolving dependencies

Given a list of targets of either repo or AUR packages it will resolve the dependencies needed to install them.

This resolver assumes all the repo packages will be installed first, then each base is built and installed together.

aur-depends will try to solve dependnecies using the minimum ammount of AUR RPC requests.

Resolving is done via the AUR RPC. No packages are downloaded.

Example

use std::collections::HashSet;
use alpm::Alpm;
use raur::Handle;

use aur_depends::{Flags, Resolver};

let alpm = Alpm::new("/", "/var/lib/pacman")?;
let raur = Handle::default();
let mut cache = HashSet::new();
let resolver = Resolver::new(&alpm, &mut cache, &raur, Flags::new() | Flags::AUR_ONLY);
let actions = resolver.resolve_targets(&["discord-canary", "spotify"])?;

for install in &actions.install {
    println!("install: {}", install.pkg.name())
}

for build in actions.iter_build_pkgs() {
    println!("build: {}", build.pkg.name)
}

Methods

impl<'a, H> Resolver<'a, H> where
    H: Raur<Err = Error>, 
[src]

pub fn new(
    alpm: &'a Alpm,
    cache: &'a mut Cache,
    raur: &'a H,
    flags: Flags
) -> Self
[src]

Create a new Resolver

pub fn provider_callback<F: Fn(&[&str]) -> usize + 'static>(self, f: F) -> Self[src]

Set the provider callback

The provider callback will be called any time there is a choice of multiple AUR packages that can satisfy a dependency. This callback receives a slice of package names then, returns the index of which package to pick.

Retuning an invalid index will cause a panic.

pub fn aur_updates(&mut self) -> Result<AurUpdates<'a>, Error>[src]

Get which aur packages need to be updated.

Example

use std::collections::HashSet;
use alpm::Alpm;
use raur::Handle;

use aur_depends::{Flags, Resolver};

let alpm = Alpm::new("/", "/var/lib/pacman")?;
let raur = Handle::default();
let mut cache = HashSet::new();
let mut resolver = Resolver::new(&alpm, &mut cache, &raur, Flags::new() | Flags::AUR_ONLY);

let updates = resolver.aur_updates()?;

for update in updates.updates {
    println!("update: {}: {} -> {}", update.local.name(), update.local.version(),
    update.remote.version);
}

pub fn resolve_targets<S: AsTarg>(
    self,
    pkgs: &[S]
) -> Result<Actions<'a>, Error>
[src]

Resolve a list of targets.

Trait Implementations

impl<'a, H: Debug + Raur> Debug for Resolver<'a, H>[src]

Auto Trait Implementations

impl<'a, H> Unpin for Resolver<'a, H>

impl<'a, H = Handle> !Sync for Resolver<'a, H>

impl<'a, H = Handle> !Send for Resolver<'a, H>

impl<'a, H = Handle> !UnwindSafe for Resolver<'a, H>

impl<'a, H = Handle> !RefUnwindSafe for Resolver<'a, H>

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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