Trait aur::bridge::hyper::AurRequester[][src]

pub trait AurRequester {
    fn aur_info<T: Display>(
        &self,
        packages: &[T]
    ) -> Box<Future<Item = Search<InfoResult>, Error = Error> + Send>;
fn aur_search(
        &self,
        query: Option<&str>,
        maintainer: Option<&str>
    ) -> Box<Future<Item = Search<SearchResult>, Error = Error> + Send>; }

Trait which defines the methods necessary to interact with the service.

Examples

To bring in the implemenation for the hyper Client, simply use the trait:

use aur::AurHyperRequester;

At this point, the methods will be on your Hyper Client.

Required Methods

Retrieves information about one or more packages along with metadata.

Examples

Ensure that the "rust-nightly" package exists:

This example is not tested
extern crate aur;
extern crate hyper;
extern crate hyper_tls;
extern crate tokio_core;

use aur::bridge::hyper::AurRequester;
use hyper::Client;
use hyper_tls::HttpsConnector;
use tokio_core::Core;

let core = Core::new()?;

let handle = core.handle();
let connector = HttpsConnector::new(4, &handle)?;
let client = Client::configure().connector(connector).build(&handle);

let done = client.aur_info(&["rust-nightly"]).map(|search| {
    assert_eq!(search.result_count, 1);
}).map_err(|_| ());

Errors

Resolves to Error::Fmt if there was an error formatting the URI.

Resolves to Error::Hyper if there was an error sending the request.

Resolves to Error::Json if there was an error deserializing the response body.

Resolves to Error::Uri if there was an error parsing the Uri.

Searches for packages by a query, optionally filtering by maintainer name.

Examples

Ensure that at least two packages return for the "rust" query, not specifying a maintainer:

This example is not tested
extern crate aur;
extern crate hyper;
extern crate hyper_tls;
extern crate tokio_core;

use aur::bridge::hyper::AurRequester;
use hyper::Client;
use hyper_tls::HttpsConnector;
use tokio_core::Core;

let handle = core.handle();
let connector = HttpsConnector::new(4, handle)?;
let client = Client::configure().connector(connector).build(&handle);

let done = client.aur_search(Some("rust"), None).map(|search| {
    assert!(search.result_count >= 2);
}).map_err(|_| ());

Errors

Resolves to Error::Fmt if there was an error formatting the URI.

Resolves to Error::Hyper if there was an error sending the request.

Resolves to Error::Json if there was an error deserializing the response body.

Resolves to Error::Uri if there was an error parsing the Uri.

Implementations on Foreign Types

impl<C> AurRequester for HyperClient<C, Body> where
    C: Connect + Sync + 'static,
    C::Future: 'static,
    C::Transport: 'static, 
[src]

Implementors