Skip to content

Commit

Permalink
Flatten out utils contents
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackHoleFox committed Oct 18, 2020
1 parent d1e674c commit d1dead1
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/util/config.rs → src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::util::error::StartupError;
use crate::error::StartupError;
use serde::Deserialize;
use std::fs;

Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::config::ApiConfig;
use crate::error::{RequestError, StartupError};
use crate::redis::redis_link::RedisLink;
use crate::routes::{hello_world, not_found, team_info, ws};
use crate::util::config::ApiConfig;
use crate::util::error::{RequestError, StartupError};
use flexi_logger::{colored_opt_format, Age, Cleanup, Criterion, Duplicate, Logger, Naming};
use hyper::header::ACCESS_CONTROL_ALLOW_ORIGIN;
use hyper::service::{make_service_fn, service_fn};
Expand All @@ -12,9 +12,10 @@ use std::env;
use std::net::SocketAddr;
use std::sync::Arc;

mod config;
mod error;
mod redis;
mod routes;
mod util;

pub struct ApiContext {
pub config: ApiConfig,
Expand Down
4 changes: 2 additions & 2 deletions src/redis/redis_link.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::config::ApiConfig;
use crate::error::{CommunicationError, StartupError};
use crate::redis::{GearBotRequest, Reply, ReplyData, Request, TeamInfo};
use crate::util::config::ApiConfig;
use crate::util::error::{CommunicationError, StartupError};
use darkredis::{Connection, ConnectionPool};
use futures_util::StreamExt;
use tokio::sync::broadcast;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/hello.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::util::error::RequestError;
use crate::error::RequestError;
use hyper::{Body, Response};

pub async fn hello_world() -> Result<Response<Body>, RequestError> {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use team::team_info;
mod ws;
pub use ws::ws;

use crate::util::error::RequestError;
use crate::error::RequestError;
use hyper::{Body, Response, StatusCode};

pub fn not_found() -> Result<Response<Body>, RequestError> {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/team.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::util::error::RequestError;
use crate::error::RequestError;
use crate::ApiContext;
use hyper::{Body, Response};
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/ws.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::util::error::{BadRequestError, RequestError};
use crate::error::{BadRequestError, RequestError};
use crate::ApiContext;
use futures_util::StreamExt;
use hyper::header::{HeaderValue, CONNECTION, SEC_WEBSOCKET_ACCEPT, SEC_WEBSOCKET_KEY, UPGRADE};
Expand Down
2 changes: 0 additions & 2 deletions src/util/mod.rs

This file was deleted.

0 comments on commit d1dead1

Please sign in to comment.