Code Monkey home page Code Monkey logo

aur.rs's Introduction

ci-badge license-badge docs-badge rust badge

aur

aur is a package for interacting with the [Arch User Repository] RPC API.

It supports client trait implementations for both asynchronous hyper and synchronous reqwest.

Installation

This library requires at least Rust 1.21.0.

Add the following to your Cargo.toml:

[dependencies]
aur = "~0.1"

And the following to your main.rs or lib.rs:

extern crate aur;

There are two features: hyper-support and reqwest-support. hyper-support is enabled by default. To enable reqwest-support, instead depend on aur like so:

[dependencies.aur]
default-features = false
features = ["reqwest-support"]
version = "~0.1"

Examples

Asynchronously request information for the rust-nightly package:

extern crate aur;
extern crate hyper;
extern crate hyper_rustls;
extern crate tokio_core;

use aur::bridge::hyper::AurRequester;
use hyper::Client;
use hyper_rustls::HttpsConnector;

let connector = HttpsConnector::new(4);
let client = Client::builder().build(connector);

let done = client.aur_search(Some("rust-nightly"), None).map(|search| {
    assert!(search.result_count >= 2);
}).map_err(|why| {
    println!("Error getting rust-nightly info: {:?}", why);
});

tokio::run(done);

Synchronously request information for the rust-nightly package:

extern crate aur;
extern crate reqwest;

use aur::bridge::reqwest::AurRequester;
use reqwest::Client;

let client = Client::new();

let info = client.aur_info(&["rust-nightly"])?;

match info.first() {
    Some(package) => {
        if let Some(ref maintainer) = package.maintainer {
            println!("The package is maintained by: {}", maintainer);
        } else {
            println!("The package has no maintainer");
        }
    },
    None => {
        println!("No package found!");
    },
}

License

ISC.

aur.rs's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.