#consul #http-api #discovery #client #libray #service #version

knusbaum_consul

Patched version of the Rust client libray for Consul HTTP API

1 unstable release

Uses old Rust 2015

0.2.0 Jun 2, 2019

#5 in #libray

MIT/Apache

20KB
478 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]
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 consul to the dependencies in your project's Cargo.toml.

[dependencies]
consul = "*"

and this to your crate root:

extern crate consul;

Examples

use std::collections::HashMap;
use 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

~22MB
~454K SLoC