[−][src]Struct aur_depends::Resolver
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) }
Implementations
impl<'a, 'b, H> Resolver<'a, 'b, H> where
H: Raur<Err = Error>,
[src]
H: Raur<Err = Error>,
pub fn new(
alpm: &'a Alpm,
cache: &'b mut Cache,
raur: &'b H,
flags: Flags
) -> Self
[src]
alpm: &'a Alpm,
cache: &'b mut Cache,
raur: &'b H,
flags: Flags
) -> Self
Create a new Resolver
pub fn provider_callback<F: Fn(&str, &[&str]) -> usize + 'static>(
self,
f: F
) -> Self
[src]
self,
f: F
) -> Self
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 the dependency that we are trying to satisfy and a slice of package names satisfying it.
The callback returns returns the index of which package to pick.
Retuning an invalid index will cause a panic.
pub fn group_callback<F: Fn(&[Group<'a>]) -> Vec<Package<'a>> + 'static>(
self,
f: F
) -> Self
[src]
self,
f: F
) -> Self
Set the group callback
The group callback is called whenever a group is processed. The callback recieves the group and returns a list of packages should be installed from the group;
pub fn is_devel<F: Fn(&str) -> bool + 'static>(self, f: F) -> Self
[src]
Set the function for determining if a package is devel.
Devel packages are never skipped when using NEEDED.
By default, no packages are considered devel.
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<T: AsTarg>(
self,
pkgs: &[T]
) -> Result<Actions<'a>, Error>
[src]
self,
pkgs: &[T]
) -> Result<Actions<'a>, Error>
Resolve a list of targets.
Trait Implementations
Auto Trait Implementations
impl<'a, 'b, H = Handle> !RefUnwindSafe for Resolver<'a, 'b, H>
impl<'a, 'b, H = Handle> !Send for Resolver<'a, 'b, H>
impl<'a, 'b, H = Handle> !Sync for Resolver<'a, 'b, H>
impl<'a, 'b, H> Unpin for Resolver<'a, 'b, H>
impl<'a, 'b, H = Handle> !UnwindSafe for Resolver<'a, 'b, H>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,