aboutsummaryrefslogtreecommitdiff
path: root/p2p
diff options
context:
space:
mode:
Diffstat (limited to 'p2p')
-rw-r--r--p2p/src/backend.rs34
-rw-r--r--p2p/src/lib.rs37
2 files changed, 37 insertions, 34 deletions
diff --git a/p2p/src/backend.rs b/p2p/src/backend.rs
index bb0d891..4410205 100644
--- a/p2p/src/backend.rs
+++ b/p2p/src/backend.rs
@@ -20,40 +20,6 @@ pub type ArcBackend = Arc<Backend>;
/// the P2P network.
///
///
-/// # Example
-/// ```
-/// use std::sync::Arc;
-///
-/// use easy_parallel::Parallel;
-/// use smol::{channel as smol_channel, future, Executor};
-///
-/// use karyons_p2p::{Backend, Config, PeerID};
-///
-/// let peer_id = PeerID::random();
-///
-/// // Create the configuration for the backend.
-/// let mut config = Config::default();
-///
-///
-/// // Create a new Executor
-/// let ex = Arc::new(Executor::new());
-///
-/// // Create a new Backend
-/// let backend = Backend::new(peer_id, config, ex.clone());
-///
-/// let task = async {
-/// // Run the backend
-/// backend.run().await.unwrap();
-///
-/// // ....
-///
-/// // Shutdown the backend
-/// backend.shutdown().await;
-/// };
-///
-/// future::block_on(ex.run(task));
-///
-/// ```
pub struct Backend {
/// The Configuration for the P2P network.
config: Arc<Config>,
diff --git a/p2p/src/lib.rs b/p2p/src/lib.rs
index 3cf1e7c..c0a3b5b 100644
--- a/p2p/src/lib.rs
+++ b/p2p/src/lib.rs
@@ -1,3 +1,40 @@
+//! A lightweight, extensible, and customizable peer-to-peer (p2p) network stack.
+//!
+//! # Example
+//! ```
+//! use std::sync::Arc;
+//!
+//! use easy_parallel::Parallel;
+//! use smol::{channel as smol_channel, future, Executor};
+//!
+//! use karyons_p2p::{Backend, Config, PeerID};
+//!
+//! let peer_id = PeerID::random();
+//!
+//! // Create the configuration for the backend.
+//! let mut config = Config::default();
+//!
+//!
+//! // Create a new Executor
+//! let ex = Arc::new(Executor::new());
+//!
+//! // Create a new Backend
+//! let backend = Backend::new(peer_id, config, ex.clone());
+//!
+//! let task = async {
+//! // Run the backend
+//! backend.run().await.unwrap();
+//!
+//! // ....
+//!
+//! // Shutdown the backend
+//! backend.shutdown().await;
+//! };
+//!
+//! future::block_on(ex.run(task));
+//!
+//! ```
+//!
mod backend;
mod config;
mod connection;