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
//! # PubNub Hyper //! //! A PubNub client using [`hyper`](hyper) and [`tokio`](tokio) to provide an //! ultra-fast, incredibly reliable message transport over the PubNub edge //! network. //! //! Uses [`pubnub-core`](pubnub-core) under the hood. //! //! # Example //! //! ```no_run //! use futures_util::stream::StreamExt; //! use pubnub_hyper::runtime::tokio_global::TokioGlobal; //! use pubnub_hyper::transport::hyper::Hyper; //! use pubnub_hyper::{core::data::channel, core::json::object, Builder}; //! //! # async { //! let transport = Hyper::new() //! .publish_key("demo") //! .subscribe_key("demo") //! .build()?; //! let mut pubnub = Builder::new() //! .transport(transport) //! .runtime(TokioGlobal) //! .build(); //! //! let message = object! { //! "username" => "JoeBob", //! "content" => "Hello, world!", //! }; //! //! let channel_name: channel::Name = "my-channel".parse().unwrap(); //! let mut stream = pubnub.subscribe(channel_name.clone()).await; //! let timetoken = pubnub.publish(channel_name, message.clone()).await?; //! //! let received = stream.next().await; //! assert_eq!(received.unwrap().json, message); //! # Ok::<(), Box<dyn std::error::Error>>(()) //! # }; //! ``` #![deny(clippy::all)] #![deny(clippy::pedantic)] #![deny(missing_docs)] #![deny(intra_doc_link_resolution_failure)] #![allow(clippy::doc_markdown)] #![forbid(unsafe_code)] #![warn( missing_docs, missing_debug_implementations, missing_copy_implementations )] /// Re-export core for ease of use. pub mod core { pub use pubnub_core::*; } /// A sensible default variant of the tokio runtime. pub use crate::runtime::tokio_global::TokioGlobal as DefaultRuntime; /// A sensible default variant of the hyper runtime. pub use crate::transport::hyper::Hyper as DefaultTransport; pub use crate::core::Builder; use crate::core::PubNub as CorePubNub; /// PubNub client bound to hyper transport and tokio runtime. pub type PubNub = CorePubNub<DefaultTransport, DefaultRuntime>; pub mod runtime; pub mod transport; #[macro_use] mod macros;