From d0a0065807a5335f700b0c9bc3097589b2eafa48 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Wed, 9 Feb 2022 15:55:04 +0000 Subject: [PATCH] Rename 'web' module to 'net' --- src/cli/start.rs | 4 ++-- src/main.rs | 2 +- src/{web => net}/conf.rs | 0 src/{web => net}/export.rs | 2 +- src/{web => net}/fail.rs | 0 src/{web => net}/head.rs | 0 src/{web => net}/import.rs | 0 src/{web => net}/key.rs | 13 ++++++++----- src/{web => net}/log.rs | 0 src/{web => net}/mod.rs | 0 src/{web => net}/output.rs | 0 src/{web => net}/root.rs | 0 src/{web => net}/signin.rs | 2 +- src/{web => net}/signup.rs | 2 +- src/{web => net}/sql.rs | 6 +++--- src/{web => net}/status.rs | 0 src/{web => net}/sync.rs | 0 src/{web => net}/version.rs | 0 18 files changed, 17 insertions(+), 14 deletions(-) rename src/{web => net}/conf.rs (100%) rename src/{web => net}/export.rs (96%) rename src/{web => net}/fail.rs (100%) rename src/{web => net}/head.rs (100%) rename src/{web => net}/import.rs (100%) rename src/{web => net}/key.rs (97%) rename src/{web => net}/log.rs (100%) rename src/{web => net}/mod.rs (100%) rename src/{web => net}/output.rs (100%) rename src/{web => net}/root.rs (100%) rename src/{web => net}/signin.rs (96%) rename src/{web => net}/signup.rs (96%) rename src/{web => net}/sql.rs (95%) rename src/{web => net}/status.rs (100%) rename src/{web => net}/sync.rs (100%) rename src/{web => net}/version.rs (100%) diff --git a/src/cli/start.rs b/src/cli/start.rs index d0046816..8f6276e7 100644 --- a/src/cli/start.rs +++ b/src/cli/start.rs @@ -1,5 +1,5 @@ use crate::kvs; -use crate::web; +use crate::net; use anyhow::Error; use clap; @@ -20,7 +20,7 @@ pub fn init(matches: &clap::ArgMatches) -> Result<(), Error> { // Start up the kvs storage kvs::init(matches)?; // Start up the web server - web::init(matches)?; + net::init(matches)?; // Don't error when done Ok(()) } diff --git a/src/main.rs b/src/main.rs index db0200af..d7fed728 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,8 +13,8 @@ mod err; mod fnc; mod key; mod kvs; +mod net; mod sql; -mod web; fn main() { cli::init(); // Initiate the command line diff --git a/src/web/conf.rs b/src/net/conf.rs similarity index 100% rename from src/web/conf.rs rename to src/net/conf.rs diff --git a/src/web/export.rs b/src/net/export.rs similarity index 96% rename from src/web/export.rs rename to src/net/export.rs index ff580f47..07788d3c 100644 --- a/src/web/export.rs +++ b/src/net/export.rs @@ -1,6 +1,6 @@ use crate::dbs::export; use crate::dbs::Session; -use crate::web::conf; +use crate::net::conf; use hyper::body::Body; use warp::Filter; diff --git a/src/web/fail.rs b/src/net/fail.rs similarity index 100% rename from src/web/fail.rs rename to src/net/fail.rs diff --git a/src/web/head.rs b/src/net/head.rs similarity index 100% rename from src/web/head.rs rename to src/net/head.rs diff --git a/src/web/import.rs b/src/net/import.rs similarity index 100% rename from src/web/import.rs rename to src/net/import.rs diff --git a/src/web/key.rs b/src/net/key.rs similarity index 97% rename from src/web/key.rs rename to src/net/key.rs index 22248b3c..e477cd90 100644 --- a/src/web/key.rs +++ b/src/net/key.rs @@ -1,9 +1,9 @@ use crate::dbs::Session; use crate::err::Error; +use crate::net::conf; +use crate::net::head; +use crate::net::output; use crate::sql::value::Value; -use crate::web::conf; -use crate::web::head; -use crate::web::output; use bytes::Bytes; use serde::Deserialize; use std::collections::HashMap; @@ -111,8 +111,11 @@ async fn select_all( l = query.limit.unwrap_or(String::from("100")), s = query.start.unwrap_or(String::from("0")), ); - let mut vars = HashMap::new(); - vars.insert(String::from("table"), Value::from(table)); + let vars = hmap! { + String::from("table") => Value::from(table), + }; + // let mut vars = HashMap::new(); + // vars.insert(String::from("table"), Value::from(table)); match crate::dbs::execute(sql.as_str(), session, Some(vars)).await { Ok(ref res) => match output.as_ref() { "application/json" => Ok(output::json(res)), diff --git a/src/web/log.rs b/src/net/log.rs similarity index 100% rename from src/web/log.rs rename to src/net/log.rs diff --git a/src/web/mod.rs b/src/net/mod.rs similarity index 100% rename from src/web/mod.rs rename to src/net/mod.rs diff --git a/src/web/output.rs b/src/net/output.rs similarity index 100% rename from src/web/output.rs rename to src/net/output.rs diff --git a/src/web/root.rs b/src/net/root.rs similarity index 100% rename from src/web/root.rs rename to src/net/root.rs diff --git a/src/web/signin.rs b/src/net/signin.rs similarity index 96% rename from src/web/signin.rs rename to src/net/signin.rs index 265b71da..c7d87de4 100644 --- a/src/web/signin.rs +++ b/src/net/signin.rs @@ -1,4 +1,4 @@ -use crate::web::head; +use crate::net::head; use warp::http; use warp::Filter; diff --git a/src/web/signup.rs b/src/net/signup.rs similarity index 96% rename from src/web/signup.rs rename to src/net/signup.rs index c94a9a9a..5b1b8271 100644 --- a/src/web/signup.rs +++ b/src/net/signup.rs @@ -1,4 +1,4 @@ -use crate::web::head; +use crate::net::head; use warp::http; use warp::Filter; diff --git a/src/web/sql.rs b/src/net/sql.rs similarity index 95% rename from src/web/sql.rs rename to src/net/sql.rs index bbf91f63..aa034fb7 100644 --- a/src/web/sql.rs +++ b/src/net/sql.rs @@ -1,7 +1,7 @@ use crate::dbs::Session; -use crate::web::conf; -use crate::web::head; -use crate::web::output; +use crate::net::conf; +use crate::net::head; +use crate::net::output; use bytes::Bytes; use futures::{FutureExt, StreamExt}; use warp::Filter; diff --git a/src/web/status.rs b/src/net/status.rs similarity index 100% rename from src/web/status.rs rename to src/net/status.rs diff --git a/src/web/sync.rs b/src/net/sync.rs similarity index 100% rename from src/web/sync.rs rename to src/net/sync.rs diff --git a/src/web/version.rs b/src/net/version.rs similarity index 100% rename from src/web/version.rs rename to src/net/version.rs