Changed the file_contents to be stored in an &str

This commit is contained in:
2025-11-29 10:15:01 +00:00
parent ce643f2066
commit 0ee35b2795
2 changed files with 23 additions and 17 deletions

View File

@@ -23,13 +23,14 @@ lazy_static! {
// TODO, Avoid copying bytes
fn main() -> io::Result<()>
{
#![warn(clippy::pedantic, clippy::perf)]
// Default values
const BIND_ADDRESS: &str = "127.0.0.1:2008";
const INDEX_FILE: &str = "index.npon";
let (tx, rx) = mpsc::channel();
let listener = TcpListener::bind(BIND_ADDRESS).unwrap();
println!("Listening at {}", BIND_ADDRESS);
println!("Listening at {BIND_ADDRESS}");
/*
let mut file_list: Vec<std::path::PathBuf> = vec![ROOT_DIR.join(INDEX_FILE)];
@@ -43,9 +44,10 @@ fn main() -> io::Result<()>
let mut file_list: Vec<PathBuf>;
(bytes, file_list) = files::read_file(INDEX_FILE, 0);
file_list.push(ROOT_DIR.join(INDEX_FILE));
println!("Tracking: {:?}", file_list);
tx.send(bytes.clone()).unwrap();
'watch_loop: loop
loop
{
let code = files::watch_files(&file_list);
if code == 0