[][src]Struct aur_fetch::Handle

pub struct Handle {
    pub clone_dir: PathBuf,
    pub diff_dir: PathBuf,
    pub git: PathBuf,
    pub aur_url: Url,
}

Handle to the current configuration.

This handle is used to configure parts of the fetching process. All the features of this crate must be done through this handle.

Fields

clone_dir: PathBuf

The directory to place AUR packages in.

diff_dir: PathBuf

The directory to place diffs in.

git: PathBuf

The git command to run.

aur_url: Url

The AUR URL.

Methods

impl Handle[src]

pub fn new() -> Result<Self>[src]

Create a new Handle with working defaults.

This Inializes the clone and diff dir to the current dirrectory. If you want to configure a cache directory you will need to do that yourself.

pub fn download<'a, S: AsRef<str>>(&self, pkgs: &'a [S]) -> Result<Vec<&'a str>>[src]

Downloads a list of packages to the cache dir.

This downloads packages from the AUR using git. New packages will be cloned, while packages that already exist in cache will be fetched. Merging will need to be done in a separate step.

Each package is downloaded concurrently which givess a major speedup. No other functions are run concirrently as they will all complete pretty much isntantly.

Depending on how many packages are being downloaded and connection speed this function may take a little while to complete. See download_cb if you wish track the progress of each download.

This also filters the input list to packages that were already in cache. This filtered list can then be passed on to needs_merge as freshly cloned packages will not need to be merged.

pub fn download_cb<'a, S: AsRef<str>, F: Fn(Callback)>(
    &self,
    pkgs: &'a [S],
    f: F
) -> Result<Vec<&'a str>>
[src]

The same as download but calls a Callback after each download.

The callback is called each time a package download is completed.

pub fn needs_merge<'a, S: AsRef<str>>(
    &self,
    pkgs: &'a [S]
) -> Result<Vec<&'a str>>
[src]

Filters a list of packages, keeping ones that need to be merged.

Needing to be merged is defined as the current HEAD being different to the upstram HEAD.

pub fn diff<S: AsRef<str>>(
    &self,
    pkgs: &[S],
    color: bool
) -> Result<Vec<String>>
[src]

Diff a list of packages returning the diffs as strings.

Additionally this function gives you the ability to force color. This is useful if you intend to print the diffs to stdout.

pub fn save_diffs<S: AsRef<str>>(&self, pkgs: &[S]) -> Result<()>[src]

Diff a list of packages and save them to diff_dir.

pub fn make_view<S1: AsRef<str>, S2: AsRef<str>>(
    &self,
    pkgs: &[S1],
    diffs: &[S2]
) -> Result<TempDir>
[src]

Makes a view of newly downloaded files.

This view is a tmp dir containing the packages downloaded/fetched and diffs for packages that have diffs.

Files are symlinked from the cache dirs so there is no duplication of files.

pub fn merge<S: AsRef<str>>(&self, pkgs: &[S]) -> Result<()>[src]

Merge a list of packages with their upstream.

Trait Implementations

impl Clone for Handle[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Handle[src]

Auto Trait Implementations

impl Send for Handle

impl Sync for Handle

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

impl<T, U> TryInto 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> Erased for T