Skip to main content

AurApi

Trait AurApi 

Source
pub trait AurApi: Send + Sync {
    // Required methods
    fn search<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AurPackage>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn info<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        names: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AurPackageDetails>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn comments<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pkgname: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AurComment>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn pkgbuild<'life0, 'life1, 'async_trait>(
        &'life0 self,
        package: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

What: Trait for AUR operations, enabling testability via mock implementations.

Inputs: None (trait definition)

Output: Trait that defines the interface for AUR operations

Details:

  • Defines the core AUR operations: search, info, comments, and pkgbuild
  • Allows users to create mock implementations for unit testing
  • The Aur<'a> struct implements this trait for real AUR operations
  • Mock implementations can be used to test code without hitting real APIs

Required Methods§

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<AurPackage>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

What: Search for packages in the AUR by name.

Inputs:

  • query: Search query string

Output:

  • Result<Vec<AurPackage>> containing search results, or an error

Details:

  • Searches the AUR for packages matching the query
  • Returns empty vector if no results found (not an error)
Source

fn info<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, names: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<AurPackageDetails>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

What: Fetch detailed information for one or more AUR packages.

Inputs:

  • names: Slice of package names to fetch info for

Output:

  • Result<Vec<AurPackageDetails>> containing package details, or an error

Details:

  • Fetches comprehensive information for the specified packages
  • Returns empty vector if no packages found (not an error)
Source

fn comments<'life0, 'life1, 'async_trait>( &'life0 self, pkgname: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<AurComment>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

What: Fetch AUR package comments.

Inputs:

  • pkgname: Package name to fetch comments for

Output:

  • Result<Vec<AurComment>> with parsed comments, or an error

Details:

  • Fetches comments from the AUR package page
  • Comments are sorted by date (latest first)
Source

fn pkgbuild<'life0, 'life1, 'async_trait>( &'life0 self, package: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

What: Fetch PKGBUILD content for an AUR package.

Inputs:

  • package: Package name to fetch PKGBUILD for

Output:

  • Result<String> with PKGBUILD text, or an error

Details:

  • Fetches the raw PKGBUILD content for the specified package

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§