From 35ccc235c89eb01ed975fb8e560245ff3cb0c299 Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad Date: Sat, 8 Mar 2025 17:58:07 +0100 Subject: [PATCH] :recycle: Renamed .github to .gitea, Short description in README, refactor uses --- {.github => .gitea}/workflows/build.yaml | 3 ++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 4 +-- src/axum/app.rs | 41 ++++++++++++------------ 5 files changed, 27 insertions(+), 25 deletions(-) rename {.github => .gitea}/workflows/build.yaml (84%) diff --git a/.github/workflows/build.yaml b/.gitea/workflows/build.yaml similarity index 84% rename from .github/workflows/build.yaml rename to .gitea/workflows/build.yaml index bdcbe73..bdef7f5 100644 --- a/.github/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -12,7 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Build run: cargo build --verbose + - name: Run tests run: cargo test --verbose --all-features --workspace \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index ac9e987..4a8ec76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1038,7 +1038,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "lib" -version = "1.5.0" +version = "2.0.0" dependencies = [ "axum", "chrono", diff --git a/Cargo.toml b/Cargo.toml index eb340cf..f6bb82a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ homepage = "emberal.github.io" [package] name = "lib" -version = "1.5.0" +version = "2.0.0" description = "A library with utilities and helper fuctions." edition = { workspace = true } rust-version = { workspace = true } diff --git a/README.md b/README.md index 50c95e1..6524adb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# Lib +# Rust Lib 🦀 --_- +Rust library for common code, traits and utility functions diff --git a/src/axum/app.rs b/src/axum/app.rs index 9e60013..9685dda 100644 --- a/src/axum/app.rs +++ b/src/axum/app.rs @@ -1,23 +1,22 @@ -use { - axum::{ - Router, ServiceExt, extract::Request, handler::Handler, response::IntoResponse, - routing::Route, - }, - std::{ - convert::Infallible, - io, - net::{IpAddr, Ipv4Addr, SocketAddr}, - }, - tokio::net::TcpListener, - tower::{Service, layer::Layer}, - tower_http::{ - cors::CorsLayer, - normalize_path::NormalizePathLayer, - trace, - trace::{HttpMakeClassifier, TraceLayer}, - }, - tracing::{Level, info}, -}; +use axum::Router; +use axum::ServiceExt; +use axum::extract::Request; +use axum::handler::Handler; +use axum::response::IntoResponse; +use axum::routing::Route; +use std::convert::Infallible; +use std::io; +use std::net::IpAddr; +use std::net::Ipv4Addr; +use std::net::SocketAddr; +use tokio::net::TcpListener; +use tower::{Service, layer::Layer}; +use tower_http::cors::CorsLayer; +use tower_http::normalize_path::NormalizePathLayer; +use tower_http::trace; +use tower_http::trace::HttpMakeClassifier; +use tower_http::trace::TraceLayer; +use tracing::{Level, info}; // TODO trim trailing slash into macro > let _app = NormalizePathLayer::trim_trailing_slash().layer(create_app!(routes)); #[macro_export] @@ -201,7 +200,7 @@ mod tests { AppBuilder::new() .socket((Ipv4Addr::LOCALHOST, 8080)) .routes([Router::new()]) - .fallback(|| async { "Fallback" }) + .fallback(async || "Fallback") .cors(CorsLayer::new()) .normalize_path(true) .tracing(TraceLayer::new_for_http())