From 97bc91ffcdcbb6d5322d43fb4cdea41ad950bc98 Mon Sep 17 00:00:00 2001 From: prplV Date: Mon, 23 Dec 2024 09:44:53 +0300 Subject: [PATCH] added cli_pipeline doc-comms --- noxis-rs/src/options/cli_pipeline.rs | 40 +++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/noxis-rs/src/options/cli_pipeline.rs b/noxis-rs/src/options/cli_pipeline.rs index b189a36..1b73624 100644 --- a/noxis-rs/src/options/cli_pipeline.rs +++ b/noxis-rs/src/options/cli_pipeline.rs @@ -6,7 +6,19 @@ use std::{borrow::BorrowMut, net::{IpAddr, Ipv4Addr}}; // use std::io::BufReader; use tokio::io::{BufReader, AsyncWriteExt, AsyncBufReadExt}; - +/// # Fn `init_cli_pipeline` +/// ## for catching all input requests from CLI +/// +/// *input* : - +/// +/// *output* : `anyhow::Result<()>` to wrap errors +/// +/// *initiator* : fn `main` +/// +/// *managing* : `TcpListener` object to handle requests +/// +/// *depends on* : - +/// pub async fn init_cli_pipeline() -> DynResult<()> { return match init_listener().await { Some(list) => { @@ -27,6 +39,19 @@ pub async fn init_cli_pipeline() -> DynResult<()> { } } +/// # Fn `init_listener` +/// ## for creating TCP-listener for communicating with CLI +/// +/// *input* : - +/// +/// *output* : `Some` if port 7753 was opened | None if not +/// +/// *initiator* : fn `init_cli_pipeline` +/// +/// *managing* : `TcpListener` object to handle requests +/// +/// *depends on* : `tokio::net::TcpListener` +/// async fn init_listener() -> Option { return match TcpListener::bind("127.0.0.1:7753").await { Ok(listener) => { @@ -40,6 +65,19 @@ async fn init_listener() -> Option { } } +/// # Fn `process_connection` +/// ## for processing input CLI requests +/// +/// *input* : mut stream: `TcpStream` +/// +/// *output* : - +/// +/// *initiator* : fn `init_cli_pipeline` +/// +/// *managing* : mutable object of `TcpStream` +/// +/// *depends on* : `tokio::net::TcpStream` +/// async fn process_connection(mut stream: TcpStream) { // loop{ // stream.