diff --git a/src/assets.rs b/src/assets.rs index 5340d97..209c9c8 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -1,5 +1,5 @@ use axum::{ - body::{boxed, Full}, + body::Body, http::{header, StatusCode, Uri}, response::{IntoResponse, Response}, }; @@ -27,7 +27,7 @@ where match Assets::get(path.as_str()) { Some(content) => { info!("Retrieving asset with path: {path}"); - let body = boxed(Full::from(content.data)); + let body = Body::from(content.data); let mime = mime_guess::from_path(path).first_or_octet_stream(); Response::builder() .header(header::CONTENT_TYPE, mime.as_ref()) @@ -37,7 +37,7 @@ where } None => Response::builder() .status(StatusCode::NOT_FOUND) - .body(boxed(Full::from("Not Found"))) + .body(Body::from("Not Found")) .unwrap(), } } diff --git a/src/main.rs b/src/main.rs index 1157b55..4866920 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,11 @@ #![warn(clippy::all)] -#![deny(unreachable_pub, private_in_public)] +#![deny(unreachable_pub, private_bounds, private_interfaces)] #![forbid(unsafe_code)] mod assets; mod currency; mod error; -mod layout; +pub mod layout; pub mod line_item_dates; pub mod line_items; pub mod quotes; @@ -24,6 +24,7 @@ use diesel::r2d2::{ConnectionManager, Pool}; use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness}; use dotenvy::dotenv; use std::env; +use tokio::net::TcpListener; use tower_http::trace::{DefaultOnResponse, TraceLayer}; use tower_http::LatencyUnit; use tracing::{info, Level}; @@ -120,10 +121,8 @@ async fn main() { .layer(trace_layer) .fallback_service(asset_handler.into_service()); - let addr = "[::]:8080".parse().unwrap(); + let addr: std::net::SocketAddr = "[::]:8080".parse().unwrap(); info!("listening on {addr}"); - axum::Server::bind(&addr) - .serve(app.into_make_service()) - .await - .unwrap(); + let listener = TcpListener::bind(addr).await.unwrap(); + axum::serve(listener, app).await.unwrap(); }