[][src]Struct aur_fetch::Handle

pub struct Handle {
    pub clone_dir: PathBuf,
    pub diff_dir: PathBuf,
    pub git: PathBuf,
    pub git_flags: Vec<String>,
    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.

git_flags: Vec<String>

Flags passed to git.

aur_url: Url

The AUR URL.

Implementations

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 with_cache_dir<P: AsRef<Path>>(path: P) -> Self[src]

Create a new handle with a specified cache dir.

clone_dir will be a subdirectory named clone inside of the specified path. diff_dir will be a subdirectory named diff inside of the specified path.

pub fn with_combined_cache_dir<P: AsRef<Path>>(path: P) -> Self[src]

Create a new handle with a specified cache dir.

Both diffs and cloned packages will be places in the provided dir.

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

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 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 has_diff<'a, S: AsRef<str>>(&self, pkgs: &'a [S]) -> Result<Vec<&'a str>>[src]

Filters a list of packages, keep ones that have a diff.

A reoo has a diff if AUR_SEEN is defined and is different to the upstram HEAD.

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

Filterrs a list of packages, keeping ones that have not yet been seen.

A repo is seen if AUR_SEEN exists and is equal 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.

Diffing a package that is already up to date will generate a diff against an empty git tree

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

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

Diff a single package.

Relies on git diff for printing. This means output will likley be coloured and ran through less. Although this is dependent on the user's git config

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

Diff a list of packages and save them to diff_dir.

Diffing a package that is already up to date will generate a diff against an empty git tree

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.

pub fn merge_cb<S: AsRef<str>, F: Fn(Callback)>(
    &self,
    pkgs: &[S],
    cb: F
) -> Result<()>
[src]

Merge a list of packages with their upstream, calling callback for each merge.

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

Marks a list of repos as seen.

This updates AUR_SEEN to the upstream HEAD

Trait Implementations

impl Clone for Handle[src]

impl Debug for Handle[src]

Auto Trait Implementations

impl RefUnwindSafe for Handle

impl Send for Handle

impl Sync for Handle

impl Unpin for Handle

impl UnwindSafe for Handle

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.