1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
///! # Nitox - Tokio-based async NATS client
///!
///! [![Crates.io](https://img.shields.io/crates/v/nitox.svg)](https://crates.io/crates/nitox)
///! [![docs.rs](https://docs.rs/nitox/badge.svg)](https://docs.rs/nitox)
///!
///! ## Description
///!
///! Nitox is a `tokio`-based client for NATS. We wrote it because the existing library is sync and does not fit our needs.
///!
///! A lot of features are currently missing, so feel free to contribute and help us building the best Async NATS client ever!
///!
///! *There's a small extra in the `tests/` folder, some of our integration tests rely on a custom NATS server implemented with `tokio` that only implements a subset of the protocol that fits our needs for the integration testing.*
///!
///! ## Documentation
///!
///! Here: [http://docs.rs/nitox](http://docs.rs/nitox)
///!
///! ## Installation
///!
///! ```toml
///! [dependencies]
///! nitox = "0.1"
///! ```
///!
///! ## Usage
///!
///! ```rust
///! extern crate nitox;
///! extern crate futures;
///! use futures::{prelude::*, future};
///! use nitox::{NatsClient, NatsClientOptions, NatsError, commands::*};
///!
///! fn connect_to_nats() -> impl Future<Item = NatsClient, Error = NatsError> {
///! // Defaults as recommended per-spec, but you can customize them
///! let connect_cmd = ConnectCommand::builder().build().unwrap();
///! let options = NatsClientOptions::builder()
///! .connect_command(connect_cmd)
///! .cluster_uri("127.0.0.1:4222")
///! .build()
///! .unwrap();
///!
///! NatsClient::from_options(options)
///! .and_then(|client| {
///! // Makes the client send the CONNECT command to the server, but it's usable as-is if needed
///! client.connect()
///! })
///! .and_then(|client| {
///! // Client has sent its CONNECT command and is ready for usage
///! future::ok(client)
///! })
///! }
///! ```
///
///! ## License
///!
///! Licensed under either of these:
///!
///! - Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
///! [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
///! - MIT license ([LICENSE-MIT](LICENSE-MIT) or
///! [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT))
///!
///! ## Why "Nitox"?
///!
///! Standing for Nitric Oxide, an important chemical involved in communication between neurons; It's highly related to the acronym behind NATS, and you should ask the team behind it for the meaning! (*or look in the git history of `gnatsd`'s repo*)
///!
///! ## Yellow Innovation
///!
///! Yellow Innovation is the innovation laboratory of the French postal service: La Poste.
///!
///! We create innovative user experiences and journeys through services with a focus on IoT lately.
///!
///! [Yellow Innovation's website and works](http://yellowinnovation.fr/en/)
#[macro_use]
extern crate derive_builder;
extern crate failure;
#[macro_use]
extern crate failure_derive;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate bytes;
extern crate parking_lot;
extern crate rand;
#[macro_use]
extern crate log;
extern crate futures;
extern crate native_tls;
extern crate tokio_codec;
extern crate tokio_executor;
extern crate tokio_tcp;
extern crate tokio_tls;
extern crate url;
#[macro_use]
mod error;
// TODO: Handle verbose mode
// TODO: Switch parsing to using `nom`
// TODO: Support NATS Streaming Server
pub use self::error::*;
pub mod codec;
mod protocol;
pub use self::protocol::*;
pub(crate) mod net;
mod client;
pub use self::client::*;