Skip to content

Commit

Permalink
refactor: deps (#137)
Browse files Browse the repository at this point in the history
* refactor: deps

* fix: native-tls typo

* chore(deps): hyper-util v0.1.4

* fix: otel

* fix: clippy

* fix(ci): nasm on windows
  • Loading branch information
fundon authored May 27, 2024
1 parent 166242b commit fab8847
Show file tree
Hide file tree
Showing 78 changed files with 310 additions and 296 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ on:
push:
branches:
- main
- '[0-9]+.[0-9]+.x'
- "[0-9]+.[0-9]+.x"
schedule:
- cron: "0 2 * * *"
workflow_dispatch:

env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
CARGO_PROFILE_TEST_BUILD_OVERRIDE_DEBUG: true
RUST_BACKTRACE: 1
RUSTUP_MAX_RETRIES: 10
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings

jobs:
test:
Expand All @@ -26,6 +33,9 @@ jobs:
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- if: runner.os == 'Windows'
name: Install NASM for aws-lc-rs on Windows
uses: ilammy/setup-nasm@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo test --workspace --verbose
Expand Down
46 changes: 25 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ viz-smol = { version = "0.1.5", path = "viz-smol" }

anyhow = "1.0"
async-trait = "0.1"
bytes = "1.5"
bytes = "1.6"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
Expand All @@ -70,7 +70,7 @@ sync_wrapper = "1.0"
thiserror = "1.0"

# router
path-tree = "0.7.6"
path-tree = "0.7.7"

# session
sessions = "0.6"
Expand All @@ -82,8 +82,8 @@ headers = "0.4"
http = "1.1"
http-body = "1"
http-body-util = "0.1"
hyper = { version = "1.2", features = ["server"] }
hyper-util = { version = "0.1.3", features = ["server-auto", "tokio"] }
hyper = { version = "1.3" }
hyper-util = { version = "0.1.4", features = ["tokio", "server"] }
mime = "0.3"
mime_guess = "2.0"
percent-encoding = "2.3"
Expand All @@ -92,21 +92,21 @@ hex = "0.4"
rust-embed = "8"

futures-util = "0.3"
rustls-pemfile = "1.0"
tokio = { version = "1.36", features = ["net"] }
rustls-pemfile = "2.0"
tokio = { version = "1.37", features = ["net"] }
tokio-native-tls = "0.3"
tokio-rustls = "0.24"
tokio-rustls = "0.26"
tokio-stream = "0.1"
tokio-tungstenite = "0.21"
tokio-util = "0.7"

# OpenTelemetry
opentelemetry = { version = "0.22", default-features = false }
opentelemetry_sdk = { version = "0.22", default-features = false }
opentelemetry-prometheus = { version = "0.15", features = [
opentelemetry = { version = "0.23", default-features = false }
opentelemetry_sdk = { version = "0.23", default-features = false }
opentelemetry-prometheus = { version = "0.16", features = [
"prometheus-encoding",
] }
opentelemetry-semantic-conventions = { version = "0.14" }
opentelemetry-semantic-conventions = { version = "0.15" }
prometheus = "0.13"

# Tracing
Expand All @@ -117,15 +117,15 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tower = "0.4"
tower-http = "0.5"

# soml
async-channel = "2.2"
async-executor = "1.8"
async-io = "2.2"
# Soml
async-channel = "2.3"
async-executor = "1.11"
async-io = "2.3"
async-net = "2.0"
smol-hyper = "0.1.1"
smol-macros = "0.1"
macro_rules_attribute = "0.2"
futures-lite = { version = "2.1.0", default-features = false, features = ["std"] }
futures-lite = { version = "2.3", default-features = false, features = ["std"] }

[workspace.metadata.docs.rs]
all-features = true
Expand All @@ -141,18 +141,22 @@ debug = false

[workspace.lints.rust]
unsafe_code = "forbid"
rust_2018_idioms = "warn"
# rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
non_ascii_idents = "warn"
non_local_definitions = 'warn'
unreachable_pub = "warn"
missing_debug_implementations = "warn"
missing_docs = "warn"

[workspace.lints.clippy]
all = "deny"
pedantic = "deny"
missing_errors_doc = "warn"
needless_pass_by_value = "warn"
all = "warn" # Downgrade deny-by-default lints
pedantic = "warn"
missing_errors_doc = { level = "allow", priority = 1 }
module_name_repetitions = { level = "allow", priority = 1 }
too_many_lines = { level = "allow", priority = 1 }
type_complexity = { level = "allow", priority = 1 }
lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12270

[workspace.lints.rustdoc]
private_intra_doc_links = 'allow'
2 changes: 1 addition & 1 deletion examples/htmlx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ serde_json.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }

handlebars = { version = "5", features = ["dir_source"] }
once_cell = "1.19"
once_cell = "1"
2 changes: 1 addition & 1 deletion examples/limits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ publish = false
[dependencies]
viz = { workspace = true, features = ["limits", "json", "form", "multipart"] }

serde = { version = "1.0", features = ["derive"] }
serde = { workspace = true, features = ["derive"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
2 changes: 1 addition & 1 deletion examples/otel/tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ viz = { workspace = true, features = ["otel-tracing"] }

tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
opentelemetry.workspace = true
opentelemetry-otlp = { version = "0.15", default-features = false, features = ["trace", "http-proto"] }
opentelemetry_sdk = { workspace = true, features = ["trace", "rt-tokio-current-thread"] }
opentelemetry-otlp = { version = "0.16", default-features = false, features = ["trace", "http-proto"] }
2 changes: 1 addition & 1 deletion examples/routing/openapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ serde_json.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }

utoipa = "4"
utoipa-swagger-ui = "6"
utoipa-swagger-ui = "7"
2 changes: 1 addition & 1 deletion examples/static-files/include-dir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

[dependencies]
viz.workspace = true
http-body-util.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }

include_dir = "0.7"
http-body-util = "0.1"
2 changes: 1 addition & 1 deletion examples/static-routes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ viz.workspace = true

hyper.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
once_cell = "1.19"
once_cell = "1"
1 change: 1 addition & 0 deletions examples/templates/askama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ publish = false
viz.workspace = true

tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }

askama = "0.12"
1 change: 1 addition & 0 deletions examples/templates/maud/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ publish = false
viz.workspace = true

tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }

maud = "0.26"
2 changes: 1 addition & 1 deletion examples/templates/minijinja/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ viz.workspace = true

serde.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
minijinja = { version = "1", features = ["loader"] }
minijinja = { version = "2", features = ["loader"] }
once_cell = "1.19"
5 changes: 3 additions & 2 deletions examples/templates/tera/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ viz.workspace = true

serde.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
tera = "1.18"
once_cell = "1.19"

tera = "1.19"
once_cell = "1"
2 changes: 1 addition & 1 deletion viz-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mime.workspace = true

rfc7239 = "0.1" # realip
cookie = { version = "0.18", features = ["percent-encode"], optional = true }
form-data = { version = "0.5.3", optional = true }
form-data = { version = "0.5.5", optional = true }
serde = { workspace = true, features = ["derive"], optional = true }
serde_json = { workspace = true, optional = true }
serde_urlencoded = { workspace = true, optional = true }
Expand Down
4 changes: 2 additions & 2 deletions viz-core/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use sync_wrapper::SyncWrapper;
use crate::{BoxError, Error, HttpBody, Result};

/// A body state.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum BodyState {
/// The body is inited.
Normal,
Expand Down Expand Up @@ -41,7 +41,7 @@ pub enum Body<D = Bytes> {
impl Body {
/// Creates an empty body.
#[must_use]
pub fn empty() -> Self {
pub const fn empty() -> Self {
Self::Empty
}

Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,4 @@ pub trait HandlerExt<I>: Handler<I> {
}
}

impl<I, T: ?Sized> HandlerExt<I> for T where T: Handler<I> {}
impl<I, T> HandlerExt<I> for T where T: ?Sized + Handler<I> {}
2 changes: 1 addition & 1 deletion viz-core/src/handler/after.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct After<H, F> {
impl<H, F> After<H, F> {
/// Creates an [`After`] handler.
#[inline]
pub fn new(h: H, f: F) -> Self {
pub const fn new(h: H, f: F) -> Self {
Self { h, f }
}
}
Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler/and_then.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct AndThen<H, F> {
impl<H, F> AndThen<H, F> {
/// Creates an [`AndThen`] handler.
#[inline]
pub fn new(h: H, f: F) -> Self {
pub const fn new(h: H, f: F) -> Self {
Self { h, f }
}
}
Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler/around.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Around<H, F> {
impl<H, F> Around<H, F> {
/// Creates an [`Around`] handler.
#[inline]
pub fn new(h: H, f: F) -> Self {
pub const fn new(h: H, f: F) -> Self {
Self { h, f }
}
}
Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler/before.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Before<H, F> {
impl<H, F> Before<H, F> {
/// Creates a [`Before`] handler.
#[inline]
pub fn new(h: H, f: F) -> Self {
pub const fn new(h: H, f: F) -> Self {
Self { h, f }
}
}
Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler/catch_unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct CatchUnwind<H, F> {
impl<H, F> CatchUnwind<H, F> {
/// Creates an [`CatchUnwind`] handler.
#[inline]
pub fn new(h: H, f: F) -> Self {
pub const fn new(h: H, f: F) -> Self {
Self { h, f }
}
}
Expand Down
2 changes: 2 additions & 0 deletions viz-core/src/handler/cloneable.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::redundant_pub_crate)]

use super::Handler;

pub(crate) type BoxCloneable<Input, Output> = Box<dyn Cloneable<Input, Output = Output>>;
Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Map<H, F> {
impl<H, F> Map<H, F> {
/// Creates a [`Map`] handler.
#[inline]
pub fn new(h: H, f: F) -> Self {
pub const fn new(h: H, f: F) -> Self {
Self { h, f }
}
}
Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler/map_err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct MapErr<H, F> {
impl<H, F> MapErr<H, F> {
/// Creates a [`MapErr`] handler.
#[inline]
pub fn new(h: H, f: F) -> Self {
pub const fn new(h: H, f: F) -> Self {
Self { h, f }
}
}
Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler/map_into_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct MapInToResponse<H>(pub(crate) H);
impl<H> MapInToResponse<H> {
/// Creates a [`MapInToResponse`] handler.
#[inline]
pub fn new(h: H) -> Self {
pub const fn new(h: H) -> Self {
Self(h)
}
}
Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler/or_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct OrElse<H, F> {
impl<H, F> OrElse<H, F> {
/// Creates an [`OrElse`] handler.
#[inline]
pub fn new(h: H, f: F) -> Self {
pub const fn new(h: H, f: F) -> Self {
Self { h, f }
}
}
Expand Down
2 changes: 1 addition & 1 deletion viz-core/src/handler/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct ServiceHandler<S>(S);

impl<S> ServiceHandler<S> {
/// Creates a new [`ServiceHandler`].
pub fn new(s: S) -> Self {
pub const fn new(s: S) -> Self {
Self(s)
}
}
Expand Down
12 changes: 6 additions & 6 deletions viz-core/src/into_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ impl IntoResponse for Response {
impl IntoResponse for Error {
fn into_response(self) -> Response {
match self {
Error::Boxed(error) => {
Self::Boxed(error) => {
let body = error.to_string();
Response::builder()
.status(StatusCode::INTERNAL_SERVER_ERROR)
.header(CONTENT_LENGTH, body.len())
.body(Full::from(body).into())
.unwrap()
}
Error::Responder(resp) | Error::Report(_, resp) => resp,
Self::Responder(resp) | Self::Report(_, resp) => resp,
}
}
}
Expand Down Expand Up @@ -109,10 +109,10 @@ where
T: IntoResponse,
{
fn into_response(self) -> Response {
match self {
Some(r) => r.into_response(),
None => StatusCode::NOT_FOUND.into_response(),
}
self.map_or_else(
|| StatusCode::NOT_FOUND.into_response(),
IntoResponse::into_response,
)
}
}

Expand Down
Loading

0 comments on commit fab8847

Please sign in to comment.