diff options
author | Katharina Fey <kookie@spacekookie.de> | 2018-06-07 17:18:58 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2018-06-07 17:18:58 +0200 |
commit | b9748ab6bff34233ed55d4db6f461e7d610b36c9 (patch) | |
tree | c4159e1ff1dd03714e53977c7eaae22983151878 | |
parent | 257bc9bf0ed79ac1e9631e585f39f9af778d87c4 (diff) |
Adding more documentation
-rw-r--r-- | lockchain-http/src/lib.rs | 20 | ||||
-rw-r--r-- | lockchain-http/src/model.rs | 5 |
2 files changed, 19 insertions, 6 deletions
diff --git a/lockchain-http/src/lib.rs b/lockchain-http/src/lib.rs index a808c1b..dc96bbd 100644 --- a/lockchain-http/src/lib.rs +++ b/lockchain-http/src/lib.rs @@ -1,7 +1,15 @@ -// //! A plug and play http interface layer for various lockchain components -// #![feature(external_doc)] -// #![doc(include = "../README.md")] -// #![feature(non_modrs_mods)] +//! A plug and play http interface layer for various lockchain components +//! +//! The way this is done is by shimming a common REST interface (via actix-web) in +//! between common `lockchain-core` types and the `lockchain-client` library which +//! is a base wrapper around `reqwest` which uses this API. +//! +//! You can of course also use whatever other library, in whatever language you want +//! to access this API. Doing so via the *official* client gives you the ability to +//! negotiate version numbers and have more advanced error handling built-in. +//! +//! Ideally this shim-layer version should be the same as the `lockchain-core` it binds +//! against, however especially during development this won't always be the case. #[macro_use] extern crate serde_derive; @@ -13,10 +21,10 @@ extern crate lockchain_core as lockchain; use actix::{server, App}; use lockchain::traits::Body; +mod handlers; mod model; -pub use model::CarrierMessage; -mod handlers; +pub use model::CarrierMessage; /// Starts a new lockchain server for a certain payload type /// diff --git a/lockchain-http/src/model.rs b/lockchain-http/src/model.rs index bb3eefa..bd8b6c1 100644 --- a/lockchain-http/src/model.rs +++ b/lockchain-http/src/model.rs @@ -3,6 +3,11 @@ use lockchain::errors::Error as LockError; use serde::{Serialize, de::DeserializeOwned}; +/// A generic container that json wraps lockchain-types +/// +/// This is heavily used in the lockchain-REST API and can be utilised +/// to send both encrypted and cleartext data via the API endpoint, using +/// the same code. #[derive(Serialize, Deserialize)] pub struct CarrierMessage<T: Serialize + DeserializeOwned> { pub error: Result<(), LockError>, |