From 3a080227419c8ba78515be1c1717e3dcfd61919b Mon Sep 17 00:00:00 2001
From: Darius Auding <Darius.auding@gmx.de>
Date: Fri, 23 Jun 2023 15:14:24 +0200
Subject: [PATCH] Add some documentation

---
 core/http/src/handling/request/cookies.rs |  1 +
 core/http/src/setup.rs                    | 28 +++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 mode change 100644 => 100755 core/http/src/setup.rs

diff --git a/core/http/src/handling/request/cookies.rs b/core/http/src/handling/request/cookies.rs
index c9d0fcd..c11bd45 100644
--- a/core/http/src/handling/request/cookies.rs
+++ b/core/http/src/handling/request/cookies.rs
@@ -45,6 +45,7 @@ mod test {
         ];
 
         let mut wrong = vec!["GET / HTTP/1.1".to_string()];
+
         assert_eq!(None, extract_cookies_from_vec(&mut wrong));
         let cookies = extract_cookies_from_vec(&mut request_vec);
         assert_eq!(right_finished_vec, request_vec);
diff --git a/core/http/src/setup.rs b/core/http/src/setup.rs
old mode 100644
new mode 100755
index 4a3914b..c7f4522
--- a/core/http/src/setup.rs
+++ b/core/http/src/setup.rs
@@ -65,6 +65,18 @@ impl<'a> Config {
         }
         self
     }
+    /// # Launches/Starts the webserver
+    /// Launches a Webserver Configuration
+    /// 
+    /// Is Async
+    ///
+    /// Is Blocking -> Can be interrupted with ^C
+    ///
+    /// # Panics
+    /// Panics if there are no Mountpoints in the Confiuration to lauch, as well as when the there
+    /// is no interrupt signal
+    ///
+    /// Panics if .
     pub async fn launch(self) {
         println!("Server launched from http://{}", self.address.local_addr().unwrap());
         let mut sigint = signal(SignalKind::interrupt()).unwrap();
@@ -82,6 +94,22 @@ impl<'a> Config {
         }
     }
 }
+/// # Creates a Webserver Config which can be launched with the launch function
+/// Takes the IP and Port as an argument
+///
+/// Prints out the configuration test
+///
+/// Is async
+///
+/// # Example
+/// ```
+/// async fn example() {
+///     let _ = http::build("127.0.0.1:8000");
+/// }
+/// ```
+/// # Panics
+/// Panics if the IP is not bindable, or other forms of system errors or it's not a valid
+/// IP-Address
 pub async fn build(ip: &str) -> Config {
     let listener = if let Ok(listener) = TcpListener::bind(ip).await {
         listener
-- 
GitLab