async-nng 0.2.0

Async wrappers for working with nng-rs types and operations.
Documentation
//! # About
//!
//! `async-nng` is a small wrapper that uses the
//! [`async-channel`](https://docs.rs/async-channel/latest/async_channel/) crate alongside the
//! [`nng`](https://docs.rs/nng/latest/nng/) crate to provide types that provide async-await
//! semantics around send and receive operations on an NNG socket.
//!
//! The futures that are constructed by the wrapper types in this crate directly utilize the
//! [`nng::Aio`](https://docs.rs/nng/latest/nng/struct.Aio.html) framework, and do not use any
//! `spawn_blocking`, `unblock`, or send any data to a backing threadpool in order to work. This
//! makes it extremely useful to use in scenarios where the
//! [`blocking`](https://docs.rs/blocking/latest/blocking/) crate or the `tokio` equivalent
//! (`spawn_blocking`) are undesirable.
//!
//! # Installing
//!
//! ```bash
//! $ cargo add async-nng
//! ```
//!
//! # Runtime Selection
//!
//! This crate should work with any of `tokio`, `async-std`, or `smol`. The tests in this crate use
//! `smol` purely to save on the number of dev-dependencies, but there are no types used within
//! this crate itself that rely on spawning tasks or any executor-specific API.
//!
//! # `AsyncContext` and `AsyncSocket`
//!
//! The two primary types provided by this crate are `AsyncContext` and `AsyncSocket`. In almost
//! all instances, one should prefer contexts to sockets when writing asynchronous and concurrent
//! programs. See the documentation for [`AsyncContext`] for more information.
//!
//! [`AsyncSocket`] is provided as well for those using raw-mode sockets or who otherwise cannot
//! take advantage of contexts. Unlike contexts which borrow the underlying [`nng::Socket`],
//! `AsyncSocket` itself is an owning type and owns the socket. An [`AsyncSocket::into_inner`] is
//! provided so that the original socket type can be recovered if there is an error or some other
//! reason to get access to the underlying socket.
//!
//! # Acknowledgements
//!
//! Thanks to `@neachdainn` in the NNG discord (and maintainer of the `nng` crate) for helping me
//! in constructing the MVP for async-await semantics wrapping the `nng` crate.

mod cancel_guard;
mod context;
mod socket;

pub use context::AsyncContext;
pub use socket::AsyncSocket;