From fb37ffd0e62b28f546be0203dcf0a9ab6b5bb42d Mon Sep 17 00:00:00 2001 From: Celeste Date: Sat, 12 Mar 2022 18:30:03 +0000 Subject: [PATCH] Documentation can always be better! --- Cargo.toml | 2 +- src/lib.rs | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c98c6de..89efc92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "packeteer" description = "An attempt at a Rust library that can be used to assist in programmatically analysing, serving and handling received protocol packets." -version = "0.1.2" +version = "0.1.3" edition = "2021" authors = ["Celeste "] license = "LGPL-3.0-or-later" diff --git a/src/lib.rs b/src/lib.rs index 5c07eca..5fcf767 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,32 @@ //! In all seriousness, packeteer is a crate made to assist with programmatically analysing, serving and handling received protocol packets. //! This is great for servers, clients, proxies as well as packet sniffers, capturers and analysers. //! Packeteer doesn't implement any ability to send or receive requests/responses nor does it handle streams or threads for you and is instead supposed to be used in applications to structure packets and potentially do automated operations on them as defined by packeteer modules. - +//! +//! To include packeteer in your project, you'll need to enable the modules you need. For example, if you required the usage of the http1 module, you would add the following to your `Cargo.toml` file: +//! +//! ```toml +//! packeteer = { version = "0.1", features = ["http1"] } +//! ``` +//! +//! It's safe to use ambigious version numbers that exclude the bugfix number as breaking changes or new features will result in an increment of the minor version number, or possibly major version number in the future. +//! +//! Packeteer aims to use as little dependencies as possible. The less dependenices that packeteer uses, the less storage your project uses. Being conservative with dependencies also makes compilation infinitely faster. +//! +//! An example of request generation using the http1 module: +//! +//! ```no_run +//! use packeteer::http1::* +//! +//! fn main() { +//! // generate_request(method, host, location, body) +//! // GET requests don't really require bodies. +//! let request = generate_request("GET", "example.service", "/api/example_endpoint", ""); +//! let req_raw = unpack_request(request); +//! +//! // Now to send req_raw through a stream to your client! +//! } +//! ``` +//! /// A global structure for key value headers. /// Can be automatically generated with the function packeteer::generate_kvheader. #[derive(Debug)]