From d554e688e242361cc8a23d0904954e897df4c562 Mon Sep 17 00:00:00 2001 From: Compositr Date: Sun, 3 Nov 2024 21:34:07 +1100 Subject: [PATCH] style: run rustfmt --- src/handlers.rs | 4 +++- src/http.rs | 2 +- src/http/responses.rs | 4 ++-- src/icons.rs | 14 +++++++------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/handlers.rs b/src/handlers.rs index ed08e1e..6cd8042 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -6,7 +6,9 @@ use crate::{ threads::ThreadPool, }; use std::{ - collections::HashMap, net::{Shutdown, TcpListener}, sync::Arc + collections::HashMap, + net::{Shutdown, TcpListener}, + sync::Arc, }; type DynHandlerFn = dyn Fn(Request) -> Response + Send + Sync; diff --git a/src/http.rs b/src/http.rs index c4a744d..116da0f 100644 --- a/src/http.rs +++ b/src/http.rs @@ -1,2 +1,2 @@ +pub mod requests; pub mod responses; -pub mod requests; \ No newline at end of file diff --git a/src/http/responses.rs b/src/http/responses.rs index b56066d..75a7de7 100644 --- a/src/http/responses.rs +++ b/src/http/responses.rs @@ -16,7 +16,7 @@ pub struct Response { impl Response { /// Create a new response from a request - /// + /// /// request: the request to respond to /// status: the HTTP status code /// body: the body of the response (see Body enum) @@ -29,7 +29,7 @@ impl Response { } /// Send off this response (write to the stream) - /// + /// /// Consumes the response and returns a Result with either () or a Boxed Error pub fn send(self) -> UnitOrBoxedError { send_response(self.request.mut_stream(), self.status, self.body) diff --git a/src/icons.rs b/src/icons.rs index 9cfd098..054abaf 100644 --- a/src/icons.rs +++ b/src/icons.rs @@ -34,10 +34,10 @@ impl Icons { } /// Check if the icon exists - /// + /// /// Cheap; does not actually call the fs - instead checks against the cached filenames in the Vec internal to this struct. /// Therefore, it is not guaranteed to be up-to-date with the actual filesystem - /// + /// /// icon: the icon name to check (no .svg extension) pub fn has_iconname(&self, icon: &str) -> bool { self.icon_filenames @@ -50,16 +50,16 @@ impl Icons { } /// Get the number of icons - /// + /// /// Cheap; does not actually call the fs - instead returns the length of the cached filenames in the Vec internal to this struct. pub fn icons_len(&self) -> usize { self.icon_filenames.len() } /// Read an .svg icon from disk to a Vec - /// + /// /// You may want to check if the icon exists first with has_iconname(), although that method does not guarantee the icon is still present on the disk. - /// + /// /// icon: the icon name to read (no .svg extension) pub fn get_icon(&self, icon: &str) -> Option> { let icon_path = format!("{}/{}.svg", self.icons_dir_path, icon); @@ -67,9 +67,9 @@ impl Icons { } /// Read an .svg icon from disk to a String, instead of a Vec - /// + /// /// You may want to check if the icon exists first with has_iconname(), although that method does not guarantee the icon is still present on the disk. - /// + /// /// icon: the icon name to read (no .svg extension) pub fn get_icon_string(&self, icon: &str) -> Option { let icon_path = format!("{}/{}.svg", self.icons_dir_path, icon);