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
//! # unit-rs
//!
//! `unit-rs` is a safe wrapper around the C `libunit` library from [Nginx Unit],
//! which allows creating Unit applications in Rust.
//!
//! [Nginx Unit]: https://unit.nginx.org/
//!
//! Currently very few features are supported, but enough are available to
//! inspect all aspects of a request and create a response.
//!
//! ## Example
//!
//! ```no_run
//! use unit_rs::Unit;
//!
//! fn main() {
//! let mut unit = Unit::new();
//!
//! unit.set_request_handler(|req| {
//! let headers = &[("Content-Type", "text/plain")];
//! let body = "Hello world!\n";
//! req.create_response(headers, body)?;
//!
//! Ok(())
//! });
//!
//! unit.run();
//! }
//! ```
mod nxt_unit;
mod request;
mod response;
mod unit;
pub use request::UnitRequest;
pub use response::UnitResponse;
pub use unit::{Unit, UnitResult, UnitError};