1 unstable release

Uses old Rust 2015

0.1.0 Jun 3, 2019

#7 in #libray

MIT/Apache

23KB
562 lines

consul-rust

Build Status

See the documentation here.

Rust client library for the Consul HTTP API.

Usage

extern crate consul;

use consul::Client;
use std::collections::HashMap;

fn main() {
    let client = Client::new("http://127.0.0.1:8500");
    let services: HashMap<String, Vec<String>> = client.catalog.services().unwrap();
    println!("{:?}", services);
}

For more examples, see the tests.

Installation

Simply include consul-rust in your Cargo dependencies.

[dependencies]
eschudt_consul = "0.1"

lib.rs:

Rust client libray for Consul HTTP API

Usage

This crate is on crates.io and can be used by adding eschudt_consul to the dependencies in your project's Cargo.toml.

[dependencies]
eschudt_consul = "*"

and this to your crate root:

extern crate consul;

Examples

use std::collections::HashMap;
use eschudt_consul::{Client, Service};

let client = Client::new("http://127.0.0.1:8500");
let services: HashMap<String, Service> = client.agent.services().unwrap();
println!("{:?}", services);

Dependencies

~8MB
~195K SLoC