From 33dd1cef4f45ea49d21ede51c7ce24e63120f89a Mon Sep 17 00:00:00 2001 From: Daniel Boros Date: Mon, 19 Oct 2026 10:01:08 +0200 Subject: [PATCH 1/2] refactor: clean up legacy APIs and fix 2.4.2 bugs Remove deprecated and unused APIs, dependencies and redundant comments; update examples, public re-exports and migration guidance. Fix timestamp-bound HMAC signatures, CSRF seed and exemption handling, IP-filter defaults, multipart limits, conditional response headers/dates, Compio SSE timers, filtered-signal lag handling, cookie headers and responses, Accept exclusions, authentication schemes, original request URIs, Swagger escaping, Vespera deprecation metadata and GraphQL request validation. Add regression coverage, reject cookie attribute injection, retain Accept parameters, and preserve extension recycling after capturing the original URI. Validation: workspace tests with default, rich and all features; rich and all-features Clippy with -D warnings; nightly formatting; all-features rustdoc; website documentation audit, TypeScript check and production build. --- Cargo.lock | 44 --- Cargo.toml | 1 - examples/auth/Cargo.lock | 64 ---- examples/autobahn-echo-compio/Cargo.lock | 51 --- examples/autobahn-echo/Cargo.lock | 49 --- examples/bench-pt/Cargo.lock | 55 --- examples/bench-pt/src/main.rs | 2 +- examples/extractors-multi/Cargo.lock | 64 ---- examples/file-stream/Cargo.lock | 64 ---- examples/graphql-generic-ws/Cargo.lock | 48 --- examples/graphql/Cargo.lock | 137 +------- examples/grpc-streaming/Cargo.lock | 63 ---- examples/grpc-unary/Cargo.lock | 63 ---- examples/health/Cargo.lock | 64 ---- examples/hello-world-compio/Cargo.lock | 55 --- examples/hello-world-http3/Cargo.lock | 57 ---- examples/hello-world/Cargo.lock | 66 ---- examples/http3-sse/Cargo.lock | 57 ---- examples/job-queue/Cargo.lock | 64 ---- examples/json-header-map/Cargo.lock | 64 ---- examples/metrics-opentelemetry/Cargo.lock | 58 ---- examples/multipart/Cargo.lock | 55 --- examples/openapi-utoipa/Cargo.lock | 64 ---- examples/openapi/Cargo.lock | 64 ---- examples/proxy-protocol/Cargo.lock | 64 ---- examples/raw-quic/Cargo.lock | 57 ---- examples/signals-advanced/Cargo.lock | 64 ---- examples/signals-advanced/src/main.rs | 9 +- examples/signals-basic/Cargo.lock | 64 ---- examples/signals-basic/src/main.rs | 4 +- examples/signals-complex/Cargo.lock | 64 ---- examples/signals-complex/src/main.rs | 6 +- examples/signals-route/Cargo.lock | 64 ---- examples/signals-rpc/Cargo.lock | 64 ---- examples/stream-compression/Cargo.lock | 66 ---- examples/streams-compio/Cargo.lock | 55 --- examples/streams/Cargo.lock | 64 ---- examples/tcp-echo/Cargo.lock | 64 ---- examples/tls-compio/Cargo.lock | 56 --- examples/typed-routes/Cargo.lock | 64 ---- examples/udp-echo/Cargo.lock | 64 ---- examples/unix-socket/Cargo.lock | 64 ---- examples/upload-progress/Cargo.lock | 64 ---- examples/websocket-compio/Cargo.lock | 51 --- examples/websocket-tls/Cargo.lock | 50 --- examples/websocket/Cargo.lock | 49 --- examples/webtransport/Cargo.lock | 57 ---- examples/with-state/Cargo.lock | 64 ---- fuzz/Cargo.lock | 40 --- tako-rs-core/Cargo.toml | 74 ++-- tako-rs-core/benches/json_extract.rs | 2 - tako-rs-core/benches/router_dispatch.rs | 2 - tako-rs-core/src/body.rs | 40 +-- tako-rs-core/src/config.rs | 30 +- tako-rs-core/src/conn_info.rs | 39 +-- tako-rs-core/src/extractors.rs | 72 +--- tako-rs-core/src/extractors/json.rs | 70 +--- tako-rs-core/src/extractors/params.rs | 8 +- tako-rs-core/src/extractors/params/decode.rs | 2 - .../src/extractors/params/deserializer.rs | 9 +- tako-rs-core/src/extractors/params/error.rs | 17 +- .../src/extractors/params/extractor.rs | 5 +- tako-rs-core/src/extractors/range.rs | 42 +-- tako-rs-core/src/extractors/typed_params.rs | 20 +- tako-rs-core/src/graphiql.rs | 14 +- tako-rs-core/src/graphql.rs | 23 +- tako-rs-core/src/graphql/apq.rs | 73 +--- tako-rs-core/src/graphql/limits.rs | 16 +- tako-rs-core/src/graphql/protocol.rs | 47 +-- tako-rs-core/src/graphql/request.rs | 160 ++------- tako-rs-core/src/graphql/response.rs | 7 +- tako-rs-core/src/graphql/subscription.rs | 32 +- tako-rs-core/src/graphql/websocket.rs | 13 +- tako-rs-core/src/grpc.rs | 17 +- tako-rs-core/src/grpc/framing.rs | 78 +---- tako-rs-core/src/grpc/health.rs | 25 +- tako-rs-core/src/grpc/interceptor.rs | 49 +-- tako-rs-core/src/grpc/message.rs | 18 +- tako-rs-core/src/grpc/reflection.rs | 41 +-- tako-rs-core/src/grpc/status.rs | 24 +- tako-rs-core/src/grpc/streaming.rs | 45 +-- tako-rs-core/src/grpc/tests.rs | 2 +- tako-rs-core/src/grpc/timeout.rs | 32 +- tako-rs-core/src/grpc/web.rs | 55 +-- tako-rs-core/src/handler.rs | 32 +- tako-rs-core/src/handler/future.rs | 7 +- tako-rs-core/src/lib.rs | 87 +---- tako-rs-core/src/middleware.rs | 24 +- tako-rs-core/src/openapi.rs | 63 +--- tako-rs-core/src/openapi/ui.rs | 9 +- tako-rs-core/src/openapi/ui/escape.rs | 23 +- tako-rs-core/src/openapi/ui/rapidoc.rs | 11 +- tako-rs-core/src/openapi/ui/redoc.rs | 8 +- tako-rs-core/src/openapi/ui/scalar.rs | 11 +- tako-rs-core/src/openapi/ui/swagger.rs | 11 +- tako-rs-core/src/openapi/utoipa.rs | 16 +- tako-rs-core/src/openapi/vespera.rs | 20 +- tako-rs-core/src/plugins.rs | 26 +- tako-rs-core/src/problem.rs | 31 +- tako-rs-core/src/queue.rs | 35 +- tako-rs-core/src/queue/backend.rs | 75 ++--- tako-rs-core/src/queue/builder.rs | 10 +- tako-rs-core/src/queue/cron.rs | 58 +--- tako-rs-core/src/queue/error.rs | 12 +- tako-rs-core/src/queue/job.rs | 25 +- tako-rs-core/src/queue/retry.rs | 20 +- tako-rs-core/src/queue/runtime.rs | 117 ++----- tako-rs-core/src/queue/signals.rs | 6 +- tako-rs-core/src/queue/worker.rs | 2 - tako-rs-core/src/recycle.rs | 41 ++- tako-rs-core/src/redirect.rs | 45 +-- tako-rs-core/src/responder.rs | 30 +- tako-rs-core/src/route.rs | 7 +- tako-rs-core/src/route/builder.rs | 55 +-- tako-rs-core/src/route/def.rs | 40 +-- tako-rs-core/src/route/openapi.rs | 20 +- tako-rs-core/src/router.rs | 7 +- tako-rs-core/src/router/definition.rs | 47 +-- tako-rs-core/src/router/dispatch.rs | 71 ++-- tako-rs-core/src/router/fast_path.rs | 27 +- tako-rs-core/src/router/introspection.rs | 15 +- tako-rs-core/src/router/layers.rs | 59 +--- tako-rs-core/src/router/method_map.rs | 28 +- tako-rs-core/src/router/mounting.rs | 101 +----- tako-rs-core/src/router/plugins.rs | 38 +-- tako-rs-core/src/router/registration.rs | 25 +- tako-rs-core/src/router/state.rs | 49 +-- tako-rs-core/src/router/timeout.rs | 6 +- tako-rs-core/src/router_state.rs | 38 +-- tako-rs-core/src/server_support.rs | 6 +- tako-rs-core/src/server_support/conn.rs | 17 +- tako-rs-core/src/server_support/driver.rs | 20 +- tako-rs-core/src/server_support/lease.rs | 9 +- tako-rs-core/src/server_support/shutdown.rs | 8 +- tako-rs-core/src/server_support/timer.rs | 10 +- tako-rs-core/src/signals.rs | 10 +- tako-rs-core/src/signals/arbiter.rs | 95 ++---- tako-rs-core/src/signals/arbiter_rpc.rs | 27 +- tako-rs-core/src/signals/rpc.rs | 15 +- tako-rs-core/src/signals/runtime.rs | 57 +--- tako-rs-core/src/signals/signal.rs | 80 +---- tako-rs-core/src/signals/transport.rs | 17 +- tako-rs-core/src/state.rs | 66 +--- tako-rs-core/src/tracing.rs | 16 +- tako-rs-core/src/types.rs | 26 +- tako-rs-core/tests/graphql_options.rs | 63 ++++ tako-rs-core/tests/graphql_receive.rs | 68 ++++ tako-rs-core/tests/swagger_ui.rs | 37 ++ tako-rs-extractors/Cargo.toml | 15 +- tako-rs-extractors/src/acc_lang.rs | 45 +-- tako-rs-extractors/src/accept.rs | 131 +++++--- tako-rs-extractors/src/basic.rs | 37 +- tako-rs-extractors/src/bearer.rs | 35 +- tako-rs-extractors/src/bytes.rs | 19 +- tako-rs-extractors/src/connect_info.rs | 14 +- .../src/content_length_limit.rs | 66 +--- tako-rs-extractors/src/cookie_jar.rs | 98 ++++-- .../src/cookie_key_expansion.rs | 103 +----- tako-rs-extractors/src/cookie_private.rs | 85 ++--- tako-rs-extractors/src/cookie_signed.rs | 13 +- tako-rs-extractors/src/cookie_signed/error.rs | 31 +- .../src/cookie_signed/extract.rs | 3 - tako-rs-extractors/src/cookie_signed/jar.rs | 59 ++-- tako-rs-extractors/src/cookie_signed/key.rs | 23 +- tako-rs-extractors/src/extension.rs | 23 +- tako-rs-extractors/src/form.rs | 48 +-- tako-rs-extractors/src/header_map.rs | 13 +- tako-rs-extractors/src/ipaddr.rs | 84 +---- tako-rs-extractors/src/jwt.rs | 81 ++--- tako-rs-extractors/src/lib.rs | 95 +----- tako-rs-extractors/src/matched_path.rs | 14 +- tako-rs-extractors/src/multipart.rs | 12 +- tako-rs-extractors/src/multipart/error.rs | 80 +++-- tako-rs-extractors/src/multipart/extractor.rs | 38 +-- tako-rs-extractors/src/multipart/field.rs | 177 +++++----- tako-rs-extractors/src/multipart/limits.rs | 63 ++-- tako-rs-extractors/src/multipart/stream.rs | 65 ++++ tako-rs-extractors/src/path.rs | 22 +- tako-rs-extractors/src/protobuf.rs | 27 +- tako-rs-extractors/src/query.rs | 34 +- tako-rs-extractors/src/query_multi.rs | 39 +-- tako-rs-extractors/src/simdjson.rs | 71 +--- tako-rs-extractors/src/state.rs | 9 +- tako-rs-extractors/src/typed_header.rs | 45 +-- tako-rs-extractors/src/uri_parts.rs | 65 +--- tako-rs-extractors/src/validate.rs | 48 +-- .../src/zero_copy_extractors.rs | 17 +- .../src/zero_copy_extractors/bytes.rs | 27 +- .../src/zero_copy_extractors/form.rs | 16 +- .../src/zero_copy_extractors/header.rs | 33 +- .../src/zero_copy_extractors/json.rs | 11 +- .../src/zero_copy_extractors/path.rs | 3 +- .../src/zero_copy_extractors/query.rs | 15 +- .../tests/cookie_regressions.rs | 83 +++++ tako-rs-extractors/tests/cookie_responses.rs | 194 +++++++++++ tako-rs-macros/src/expand.rs | 24 +- tako-rs-macros/src/lib.rs | 67 ++-- tako-rs-macros/src/parse.rs | 22 +- tako-rs-plugins/Cargo.toml | 12 +- tako-rs-plugins/src/extractors.rs | 9 +- tako-rs-plugins/src/extractors/jwt.rs | 15 +- tako-rs-plugins/src/lib.rs | 23 +- tako-rs-plugins/src/middleware.rs | 6 +- tako-rs-plugins/src/middleware/access_log.rs | 25 +- .../src/middleware/api_key_auth.rs | 102 ++---- tako-rs-plugins/src/middleware/basic_auth.rs | 59 +--- tako-rs-plugins/src/middleware/bearer_auth.rs | 47 +-- tako-rs-plugins/src/middleware/body_limit.rs | 83 ++--- .../src/middleware/circuit_breaker.rs | 89 +---- tako-rs-plugins/src/middleware/csrf.rs | 21 +- tako-rs-plugins/src/middleware/csrf/config.rs | 16 +- tako-rs-plugins/src/middleware/csrf/cookie.rs | 52 +-- tako-rs-plugins/src/middleware/csrf/layer.rs | 145 ++------ tako-rs-plugins/src/middleware/csrf/stored.rs | 21 +- tako-rs-plugins/src/middleware/csrf/token.rs | 89 ++--- tako-rs-plugins/src/middleware/etag.rs | 115 ++----- tako-rs-plugins/src/middleware/healthcheck.rs | 63 +--- .../src/middleware/hmac_signature.rs | 118 +++---- tako-rs-plugins/src/middleware/ip_filter.rs | 43 ++- tako-rs-plugins/src/middleware/json_schema.rs | 32 +- tako-rs-plugins/src/middleware/jwt_auth.rs | 20 +- .../src/middleware/jwt_auth/jwt_simple.rs | 85 ++--- .../src/middleware/jwt_auth/layer.rs | 16 +- .../src/middleware/jwt_auth/revocation.rs | 12 +- .../src/middleware/jwt_auth/verifier.rs | 10 +- .../src/middleware/problem_json.rs | 21 +- tako-rs-plugins/src/middleware/request_id.rs | 26 +- .../src/middleware/security_headers.rs | 80 ++--- tako-rs-plugins/src/middleware/session.rs | 23 +- .../src/middleware/session/cookie.rs | 10 +- .../src/middleware/session/data.rs | 32 +- .../src/middleware/session/layer.rs | 8 +- .../src/middleware/session/store.rs | 3 +- tako-rs-plugins/src/middleware/tenant.rs | 41 +-- tako-rs-plugins/src/middleware/timeout.rs | 54 +-- tako-rs-plugins/src/middleware/traceparent.rs | 54 +-- .../src/middleware/upload_progress.rs | 69 +--- tako-rs-plugins/src/plugins.rs | 10 +- tako-rs-plugins/src/plugins/compression.rs | 14 +- .../src/plugins/compression/brotli_stream.rs | 52 +-- .../src/plugins/compression/builder.rs | 77 ++--- .../src/plugins/compression/config.rs | 21 +- .../src/plugins/compression/deflate_stream.rs | 13 +- .../src/plugins/compression/encoder.rs | 7 - .../src/plugins/compression/encoding.rs | 10 +- .../src/plugins/compression/gzip_stream.rs | 19 +- .../src/plugins/compression/negotiate.rs | 23 +- .../src/plugins/compression/plugin.rs | 228 ++++--------- .../src/plugins/compression/zstd_stream.rs | 51 +-- tako-rs-plugins/src/plugins/cors.rs | 13 +- tako-rs-plugins/src/plugins/cors/builder.rs | 28 +- tako-rs-plugins/src/plugins/cors/config.rs | 34 +- .../src/plugins/cors/middleware.rs | 71 +--- tako-rs-plugins/src/plugins/cors/origin.rs | 25 +- tako-rs-plugins/src/plugins/cors/plugin.rs | 26 +- tako-rs-plugins/src/plugins/idempotency.rs | 20 +- .../src/plugins/idempotency/config.rs | 11 +- .../src/plugins/idempotency/plugin.rs | 10 +- tako-rs-plugins/src/plugins/metrics.rs | 13 +- .../src/plugins/metrics/opentelemetry.rs | 53 +-- .../src/plugins/metrics/prometheus.rs | 87 +---- .../src/plugins/metrics/recorder.rs | 58 ++-- tako-rs-plugins/src/plugins/rate_limiter.rs | 18 +- .../src/plugins/rate_limiter/algorithm.rs | 35 +- .../src/plugins/rate_limiter/config.rs | 22 +- .../src/plugins/rate_limiter/plugin.rs | 38 +-- tako-rs-plugins/src/stores.rs | 20 +- tako-rs-plugins/src/stores/memory.rs | 2 +- tako-rs-plugins/src/stores/memory/jwks.rs | 1 + .../src/stores/memory/rate_limit.rs | 35 +- tako-rs-plugins/src/stores/memory/session.rs | 1 + tako-rs-plugins/tests/csrf.rs | 180 ++++++++++ tako-rs-plugins/tests/hmac_signature.rs | 144 ++++++++ tako-rs-plugins/tests/ip_filter.rs | 108 ++++++ tako-rs-server-pt/Cargo.toml | 3 +- tako-rs-server-pt/src/config.rs | 29 +- tako-rs-server-pt/src/lib.rs | 34 +- tako-rs-server-pt/src/listener.rs | 14 +- tako-rs-server-pt/src/shutdown.rs | 57 +--- tako-rs-server-pt/src/worker.rs | 1 - tako-rs-server-pt/src/worker_compio.rs | 3 - tako-rs-server/Cargo.toml | 3 +- tako-rs-server/src/bind.rs | 25 +- tako-rs-server/src/builder.rs | 9 +- tako-rs-server/src/builder/compio_server.rs | 27 +- tako-rs-server/src/builder/handle.rs | 40 +-- tako-rs-server/src/builder/spawn.rs | 3 +- tako-rs-server/src/builder/tls_cert.rs | 90 ++--- tako-rs-server/src/builder/tokio_server.rs | 16 +- tako-rs-server/src/compio_h2.rs | 71 +--- tako-rs-server/src/config.rs | 85 ++--- tako-rs-server/src/h3_common.rs | 9 +- tako-rs-server/src/h3_common/config.rs | 7 +- tako-rs-server/src/h3_common/connection.rs | 7 +- tako-rs-server/src/h3_common/request.rs | 6 +- tako-rs-server/src/h3_common/sessions.rs | 7 +- tako-rs-server/src/lib.rs | 107 +----- tako-rs-server/src/proxy_protocol.rs | 51 +-- tako-rs-server/src/proxy_protocol/header.rs | 39 +-- tako-rs-server/src/proxy_protocol/listener.rs | 86 +---- tako-rs-server/src/proxy_protocol/v1.rs | 8 +- tako-rs-server/src/proxy_protocol/v2.rs | 30 +- tako-rs-server/src/server.rs | 106 +----- tako-rs-server/src/server_compio.rs | 76 +---- tako-rs-server/src/server_compio/accept.rs | 17 +- tako-rs-server/src/server_compio/h3.rs | 30 +- tako-rs-server/src/server_h2c.rs | 87 +---- tako-rs-server/src/server_h3.rs | 44 +-- tako-rs-server/src/server_h3/connection.rs | 15 +- tako-rs-server/src/server_h3/run.rs | 38 +-- tako-rs-server/src/server_h3/serve.rs | 108 +----- tako-rs-server/src/server_tcp.rs | 27 +- tako-rs-server/src/server_tls.rs | 61 +--- tako-rs-server/src/server_tls/config.rs | 44 --- tako-rs-server/src/server_tls/entry.rs | 102 +----- tako-rs-server/src/server_tls/serve.rs | 2 +- tako-rs-server/src/server_tls_compio.rs | 19 +- .../src/server_tls_compio/accept.rs | 5 +- tako-rs-server/src/server_tls_compio/serve.rs | 143 +------- tako-rs-server/src/server_udp.rs | 36 +- tako-rs-server/src/server_unix.rs | 25 +- tako-rs-server/src/server_unix/http.rs | 95 +----- tako-rs-server/src/server_unix/listener.rs | 20 +- tako-rs-server/src/server_unix/raw.rs | 17 +- tako-rs-server/src/server_unix/raw_compio.rs | 15 +- tako-rs-server/src/server_vsock.rs | 129 +------ tako-rs-server/src/socket_activation.rs | 41 +-- tako-rs-server/src/unix_path.rs | 33 +- tako-rs-server/src/webtransport.rs | 41 +-- tako-rs-server/src/webtransport/capsule.rs | 11 +- tako-rs-server/src/webtransport/driver.rs | 13 +- tako-rs-server/src/webtransport/session.rs | 30 +- tako-rs-server/src/webtransport/stream.rs | 14 +- tako-rs-server/src/webtransport/upgrade.rs | 6 +- tako-rs-streams/Cargo.toml | 3 - tako-rs-streams/src/file_io.rs | 4 +- tako-rs-streams/src/file_io/conditional.rs | 14 +- tako-rs-streams/src/file_io/date.rs | 2 - tako-rs-streams/src/file_io/etag.rs | 8 +- tako-rs-streams/src/file_stream.rs | 9 +- tako-rs-streams/src/file_stream/stream.rs | 35 +- tako-rs-streams/src/lib.rs | 10 +- tako-rs-streams/src/sse.rs | 17 +- tako-rs-streams/src/sse/event.rs | 34 +- tako-rs-streams/src/sse/stream.rs | 60 +--- tako-rs-streams/src/sse/timer.rs | 57 ++++ tako-rs-streams/src/static.rs | 9 +- tako-rs-streams/src/static/dir.rs | 22 +- tako-rs-streams/src/static/file.rs | 11 +- tako-rs-streams/src/static/serve.rs | 2 +- tako-rs-streams/src/webtransport.rs | 62 +--- tako-rs/src/lib.md | 7 +- tako-rs/src/lib.rs | 141 ++------ tako-rs/tests/etag_headers.rs | 175 ++++++++++ tako-rs/tests/extractor_regressions.rs | 318 ++++++++++++++++++ tako-rs/tests/extractors.rs | 97 +++++- tako-rs/tests/extractors_v2.rs | 12 +- tako-rs/tests/middleware/response.rs | 6 +- tako-rs/tests/mount_all.rs | 7 +- tako-rs/tests/openapi_deprecation.rs | 23 ++ tako-rs/tests/queue.rs | 65 +--- tako-rs/tests/queue_v2.rs | 13 +- tako-rs/tests/router.rs | 3 - tako-rs/tests/router/composition.rs | 18 +- tako-rs/tests/router_http_semantics.rs | 5 - tako-rs/tests/server_builder.rs | 19 +- tako-rs/tests/signals_filtered.rs | 30 ++ tako-rs/tests/simdjson_dual_backend.rs | 11 +- tako-rs/tests/sse_keep_alive.rs | 82 +++++ tako-rs/tests/streams_v2.rs | 3 - tako-rs/tests/tls_exports.rs | 9 + tako-rs/tests/typed_routes.rs | 4 - tako-rs/tests/udp_tcp_progress.rs | 26 +- website/content/docs/concepts/runtimes.mdx | 7 +- website/content/docs/extractors/body.mdx | 26 +- website/content/docs/extractors/cookies.mdx | 20 +- .../content/docs/extractors/request-meta.mdx | 9 +- .../docs/getting-started/ai-assistants.mdx | 2 +- website/content/docs/middleware/index.mdx | 3 +- website/content/docs/middleware/security.mdx | 3 - .../content/docs/reference/migration-2-5.mdx | 99 +++++- website/content/docs/signals.mdx | 9 +- website/content/docs/state.mdx | 36 +- website/content/docs/transports/index.mdx | 4 +- .../docs/transports/proxy-protocol.mdx | 3 +- .../content/docs/transports/tcp-udp-unix.mdx | 4 +- 386 files changed, 4359 insertions(+), 11428 deletions(-) create mode 100644 tako-rs-core/tests/graphql_options.rs create mode 100644 tako-rs-core/tests/graphql_receive.rs create mode 100644 tako-rs-core/tests/swagger_ui.rs create mode 100644 tako-rs-extractors/src/multipart/stream.rs create mode 100644 tako-rs-extractors/tests/cookie_regressions.rs create mode 100644 tako-rs-extractors/tests/cookie_responses.rs create mode 100644 tako-rs-plugins/tests/csrf.rs create mode 100644 tako-rs-plugins/tests/hmac_signature.rs create mode 100644 tako-rs-plugins/tests/ip_filter.rs delete mode 100644 tako-rs-server/src/server_tls/config.rs create mode 100644 tako-rs-streams/src/sse/timer.rs create mode 100644 tako-rs/tests/etag_headers.rs create mode 100644 tako-rs/tests/extractor_regressions.rs create mode 100644 tako-rs/tests/openapi_deprecation.rs create mode 100644 tako-rs/tests/signals_filtered.rs create mode 100644 tako-rs/tests/sse_keep_alive.rs create mode 100644 tako-rs/tests/tls_exports.rs diff --git a/Cargo.lock b/Cargo.lock index 3c15e1c6..6616f975 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4911,73 +4911,49 @@ dependencies = [ "async-graphql", "async-trait", "base64 0.22.1", - "brotli", "bytes", "chrono", "compio", - "cookie", "criterion", "cron", - "cyper-core", "envy", - "flate2", "futures-util", - "h3", - "h3-quinn", "http", "http-body", "http-body-util", "hyper", "hyper-util", - "jwt-simple", "linkme", "matchit", "mime", "mime_guess", - "multer", - "opentelemetry", - "opentelemetry-otlp", - "opentelemetry_sdk", "parking_lot", "pin-project-lite", - "prometheus", "prost", - "quinn", "rustls", "scc", "send_wrapper", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", "sha1", "sha2 0.11.0", - "simd-json", "smallvec", "sonic-rs", "tako-rs", "thread_local", "tokio", - "tokio-rustls", - "tokio-stream", - "tokio-util", "tracing", "tracing-subscriber", "url", - "urlencoding", "utoipa", - "uuid", "vespera_core", - "zstd", ] [[package]] name = "tako-rs-extractors" version = "2.4.2" dependencies = [ - "ahash", "anyhow", - "async-trait", "base64 0.22.1", "bytes", "cookie", @@ -4986,29 +4962,22 @@ dependencies = [ "headers", "hkdf 0.13.0", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", "multer", - "parking_lot", "prost", "serde", "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", "simd-json", - "smallvec", "sonic-rs", "tako-rs", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", "uuid", "validator", @@ -5027,14 +4996,12 @@ dependencies = [ name = "tako-rs-plugins" version = "2.4.2" dependencies = [ - "ahash", "anyhow", "async-trait", "base64 0.22.1", "brotli", "bytes", "compio", - "cookie", "criterion", "flate2", "futures-util", @@ -5046,8 +5013,6 @@ dependencies = [ "ipnet", "jsonschema", "jwt-simple", - "mime", - "multer", "opentelemetry", "opentelemetry-otlp", "opentelemetry_sdk", @@ -5058,18 +5023,14 @@ dependencies = [ "send_wrapper", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", "zstd", ] @@ -5103,7 +5064,6 @@ dependencies = [ "tako-rs-core", "tokio", "tokio-rustls", - "tokio-stream", "tokio-util", "tokio-vsock", "tracing", @@ -5120,7 +5080,6 @@ dependencies = [ "futures-util", "hyper", "hyper-util", - "send_wrapper", "socket2", "tako-rs", "tako-rs-core", @@ -5141,9 +5100,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", diff --git a/Cargo.toml b/Cargo.toml index e6ddab6c..090cf74a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -147,7 +147,6 @@ thread_local = "1.1.10" tikv-jemallocator = "0.7.0" tokio = { version = "1.52.1", features = ["fs", "io-util", "macros", "net", "rt", "rt-multi-thread", "signal", "sync", "time"] } tokio-rustls = "0.26.2" -tokio-stream = "0.1.17" tokio-util = { version = "0.7.15", features = ["compat"] } tokio-vsock = "0.7.2" tonic = { version = "0.14.6", default-features = false, features = ["channel"] } diff --git a/examples/auth/Cargo.lock b/examples/auth/Cargo.lock index 983415a9..2d77b3f3 100644 --- a/examples/auth/Cargo.lock +++ b/examples/auth/Cargo.lock @@ -1011,16 +1011,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1079,17 +1069,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1198,16 +1177,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1216,19 +1192,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1236,31 +1204,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1281,29 +1240,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1317,13 +1270,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1339,9 +1290,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1349,7 +1297,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1430,17 +1377,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/autobahn-echo-compio/Cargo.lock b/examples/autobahn-echo-compio/Cargo.lock index 8a76e44f..aa6a4dce 100644 --- a/examples/autobahn-echo-compio/Cargo.lock +++ b/examples/autobahn-echo-compio/Cargo.lock @@ -1608,16 +1608,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.229" @@ -1861,15 +1851,12 @@ dependencies = [ "base64", "bytes", "compio", - "cookie", - "cyper-core", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1879,19 +1866,13 @@ dependencies = [ "scc", "send_wrapper", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", "sha1", - "sha2 0.11.1", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", "url", - "urlencoding", ] [[package]] @@ -1899,31 +1880,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.1", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1945,30 +1917,24 @@ dependencies = [ "base64", "bytes", "compio", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "send_wrapper", "serde", "serde_json", - "sha1", "sha2 0.11.1", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1984,14 +1950,12 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "send_wrapper", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -2006,7 +1970,6 @@ dependencies = [ "futures-util", "hyper", "hyper-util", - "send_wrapper", "socket2", "tako-rs-core", "tokio", @@ -2026,9 +1989,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2144,17 +2104,6 @@ dependencies = [ "syn 3.0.9", ] -[[package]] -name = "tokio-stream" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.20" diff --git a/examples/autobahn-echo/Cargo.lock b/examples/autobahn-echo/Cargo.lock index fcb34852..6d97af31 100644 --- a/examples/autobahn-echo/Cargo.lock +++ b/examples/autobahn-echo/Cargo.lock @@ -1007,16 +1007,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1196,14 +1186,12 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1212,19 +1200,13 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", "url", - "urlencoding", ] [[package]] @@ -1232,31 +1214,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1277,29 +1250,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1313,13 +1280,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1335,9 +1300,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1425,17 +1387,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/bench-pt/Cargo.lock b/examples/bench-pt/Cargo.lock index d2fb0d09..8404cda1 100644 --- a/examples/bench-pt/Cargo.lock +++ b/examples/bench-pt/Cargo.lock @@ -1672,16 +1672,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1922,18 +1912,14 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", "compio", - "cookie", - "cyper-core", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1943,19 +1929,11 @@ dependencies = [ "scc", "send_wrapper", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1963,31 +1941,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -2009,30 +1978,24 @@ dependencies = [ "base64", "bytes", "compio", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "send_wrapper", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -2048,14 +2011,12 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "send_wrapper", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -2070,7 +2031,6 @@ dependencies = [ "futures-util", "hyper", "hyper-util", - "send_wrapper", "socket2", "tako-rs-core", "tokio", @@ -2090,9 +2050,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2101,7 +2058,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -2211,17 +2167,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/bench-pt/src/main.rs b/examples/bench-pt/src/main.rs index d14af4f8..13a30397 100644 --- a/examples/bench-pt/src/main.rs +++ b/examples/bench-pt/src/main.rs @@ -89,7 +89,7 @@ fn main() { backlog: 1024, ..Default::default() }; - tako::serve_per_thread_compio(&addr, build_router(), cfg).expect("serve_per_thread_compio"); + tako::serve_per_thread(&addr, build_router(), cfg).expect("serve_per_thread"); } _ => { eprintln!( diff --git a/examples/extractors-multi/Cargo.lock b/examples/extractors-multi/Cargo.lock index 753c77ea..f26a706b 100644 --- a/examples/extractors-multi/Cargo.lock +++ b/examples/extractors-multi/Cargo.lock @@ -1011,16 +1011,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1079,17 +1069,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1198,16 +1177,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1216,19 +1192,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1236,31 +1204,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1281,29 +1240,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1317,13 +1270,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1339,9 +1290,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1349,7 +1297,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1430,17 +1377,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/file-stream/Cargo.lock b/examples/file-stream/Cargo.lock index 25c84bd8..16f153ac 100644 --- a/examples/file-stream/Cargo.lock +++ b/examples/file-stream/Cargo.lock @@ -1011,16 +1011,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1079,17 +1069,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1198,16 +1177,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1216,19 +1192,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1236,31 +1204,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1281,29 +1240,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1317,13 +1270,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1339,9 +1290,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1349,7 +1297,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1430,17 +1377,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/graphql-generic-ws/Cargo.lock b/examples/graphql-generic-ws/Cargo.lock index 327befae..93662dd1 100644 --- a/examples/graphql-generic-ws/Cargo.lock +++ b/examples/graphql-generic-ws/Cargo.lock @@ -1491,16 +1491,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1720,14 +1710,12 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1736,19 +1724,14 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", "sha1", "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", "url", - "urlencoding", ] [[package]] @@ -1756,31 +1739,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1801,29 +1775,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1837,13 +1805,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1859,9 +1825,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1982,17 +1945,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/graphql/Cargo.lock b/examples/graphql/Cargo.lock index a4b8361d..10bcda23 100644 --- a/examples/graphql/Cargo.lock +++ b/examples/graphql/Cargo.lock @@ -249,17 +249,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" -[[package]] -name = "chacha20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" -dependencies = [ - "cfg-if", - "cpufeatures 0.3.1", - "rand_core 0.10.1", -] - [[package]] name = "cipher" version = "0.4.4" @@ -300,7 +289,7 @@ dependencies = [ "aes-gcm", "base64", "hmac 0.12.1", - "rand 0.8.5", + "rand", "sha2 0.10.9", "subtle", "time", @@ -338,7 +327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "rand_core 0.6.4", + "rand_core", "typenum", ] @@ -438,12 +427,6 @@ dependencies = [ "syn", ] -[[package]] -name = "data-encoding" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" - [[package]] name = "deranged" version = "0.5.8" @@ -688,7 +671,6 @@ dependencies = [ "cfg-if", "libc", "r-efi", - "rand_core 0.10.1", "wasip2", "wasip3", ] @@ -1379,18 +1361,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.4", -] - -[[package]] -name = "rand" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" -dependencies = [ - "chacha20", - "getrandom 0.4.2", - "rand_core 0.10.1", + "rand_core", ] [[package]] @@ -1400,7 +1371,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -1412,12 +1383,6 @@ dependencies = [ "getrandom 0.2.17", ] -[[package]] -name = "rand_core" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" - [[package]] name = "redox_syscall" version = "0.5.18" @@ -1525,16 +1490,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1604,17 +1559,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "sha1" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" -dependencies = [ - "cfg-if", - "cpufeatures 0.3.1", - "digest 0.11.3", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1765,14 +1709,12 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1781,20 +1723,14 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1 0.10.6", + "sha1", "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-tungstenite", - "tokio-util", "tracing", "url", - "urlencoding", ] [[package]] @@ -1802,31 +1738,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1 0.10.6", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1847,29 +1774,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1 0.10.6", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1883,13 +1804,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1899,26 +1818,19 @@ name = "tako-rs-streams" version = "2.4.2" dependencies = [ "anyhow", - "base64", "bytes", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", - "sha1 0.10.6", "tako-rs-core", "tokio", - "tokio-tungstenite", "tokio-util", "tracing", - "url", ] [[package]] @@ -2032,29 +1944,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17a073bfed563fa236697a068031408a93cd9522e08abf9933ead3e73411bd71" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite", -] - [[package]] name = "tokio-util" version = "0.7.18" @@ -2130,22 +2019,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tungstenite" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48ac77174b19c110a50ab2128b24215ac9cb40e0e12e093fb602d175c569d22" -dependencies = [ - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand 0.10.3", - "sha1 0.11.0", - "thiserror", -] - [[package]] name = "typenum" version = "1.19.0" diff --git a/examples/grpc-streaming/Cargo.lock b/examples/grpc-streaming/Cargo.lock index 4ad8801d..daf5a311 100644 --- a/examples/grpc-streaming/Cargo.lock +++ b/examples/grpc-streaming/Cargo.lock @@ -1010,16 +1010,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.229" @@ -1078,17 +1068,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1210,14 +1189,12 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1227,19 +1204,11 @@ dependencies = [ "prost", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1247,31 +1216,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1292,29 +1252,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1328,13 +1282,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1350,9 +1302,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1360,7 +1309,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1440,17 +1388,6 @@ dependencies = [ "syn 3.0.6", ] -[[package]] -name = "tokio-stream" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.19" diff --git a/examples/grpc-unary/Cargo.lock b/examples/grpc-unary/Cargo.lock index ff00ca65..9dae18d8 100644 --- a/examples/grpc-unary/Cargo.lock +++ b/examples/grpc-unary/Cargo.lock @@ -1091,16 +1091,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1159,17 +1149,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1289,14 +1268,12 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1306,19 +1283,11 @@ dependencies = [ "prost", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1326,31 +1295,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1371,29 +1331,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1407,13 +1361,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1429,9 +1381,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1439,7 +1388,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1520,17 +1468,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/health/Cargo.lock b/examples/health/Cargo.lock index 0924bbea..97831a06 100644 --- a/examples/health/Cargo.lock +++ b/examples/health/Cargo.lock @@ -1011,16 +1011,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1079,17 +1069,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1198,16 +1177,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1216,19 +1192,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1236,31 +1204,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1281,29 +1240,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1317,13 +1270,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1339,9 +1290,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1349,7 +1297,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1429,17 +1376,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/hello-world-compio/Cargo.lock b/examples/hello-world-compio/Cargo.lock index 1ae7a7e1..49ddcddd 100644 --- a/examples/hello-world-compio/Cargo.lock +++ b/examples/hello-world-compio/Cargo.lock @@ -1670,16 +1670,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1920,18 +1910,14 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", "compio", - "cookie", - "cyper-core", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1941,19 +1927,11 @@ dependencies = [ "scc", "send_wrapper", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1961,31 +1939,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -2007,30 +1976,24 @@ dependencies = [ "base64", "bytes", "compio", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "send_wrapper", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -2046,14 +2009,12 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "send_wrapper", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -2068,7 +2029,6 @@ dependencies = [ "futures-util", "hyper", "hyper-util", - "send_wrapper", "socket2", "tako-rs-core", "tokio", @@ -2088,9 +2048,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2099,7 +2056,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -2208,17 +2164,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/hello-world-http3/Cargo.lock b/examples/hello-world-http3/Cargo.lock index a4dc4281..6f8a7c8d 100644 --- a/examples/hello-world-http3/Cargo.lock +++ b/examples/hello-world-http3/Cargo.lock @@ -2034,16 +2034,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -2289,42 +2279,27 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", - "h3", - "h3-quinn", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", "mime_guess", "parking_lot", "pin-project-lite", - "quinn", "rustls", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-rustls", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -2332,31 +2307,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -2377,29 +2343,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -2416,7 +2376,6 @@ dependencies = [ "h3-quinn", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", @@ -2425,7 +2384,6 @@ dependencies = [ "tako-rs-core", "tokio", "tokio-rustls", - "tokio-stream", "tokio-util", "tracing", ] @@ -2441,9 +2399,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2453,7 +2408,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -2608,17 +2562,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/hello-world/Cargo.lock b/examples/hello-world/Cargo.lock index 38ed28be..68170c62 100644 --- a/examples/hello-world/Cargo.lock +++ b/examples/hello-world/Cargo.lock @@ -1108,16 +1108,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1176,17 +1166,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1302,18 +1281,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", - "brotli", "bytes", - "cookie", "envy", - "flate2", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1322,19 +1296,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1342,31 +1308,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1388,30 +1345,24 @@ dependencies = [ "base64", "brotli", "bytes", - "cookie", "flate2", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1425,13 +1376,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1462,9 +1411,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1472,7 +1418,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1553,17 +1498,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/http3-sse/Cargo.lock b/examples/http3-sse/Cargo.lock index c851abee..fee4f96d 100644 --- a/examples/http3-sse/Cargo.lock +++ b/examples/http3-sse/Cargo.lock @@ -2041,16 +2041,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -2296,42 +2286,27 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", - "h3", - "h3-quinn", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", "mime_guess", "parking_lot", "pin-project-lite", - "quinn", "rustls", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-rustls", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -2339,31 +2314,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -2384,29 +2350,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -2423,7 +2383,6 @@ dependencies = [ "h3-quinn", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", @@ -2432,7 +2391,6 @@ dependencies = [ "tako-rs-core", "tokio", "tokio-rustls", - "tokio-stream", "tokio-util", "tracing", ] @@ -2448,9 +2406,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2460,7 +2415,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -2615,17 +2569,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/job-queue/Cargo.lock b/examples/job-queue/Cargo.lock index 23a79d22..d9373773 100644 --- a/examples/job-queue/Cargo.lock +++ b/examples/job-queue/Cargo.lock @@ -1027,16 +1027,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1095,17 +1085,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1223,16 +1202,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1241,19 +1217,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1261,31 +1229,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1306,29 +1265,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1342,13 +1295,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1364,9 +1315,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1374,7 +1322,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1455,17 +1402,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/json-header-map/Cargo.lock b/examples/json-header-map/Cargo.lock index 39384194..8e9ba70a 100644 --- a/examples/json-header-map/Cargo.lock +++ b/examples/json-header-map/Cargo.lock @@ -1011,16 +1011,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1079,17 +1069,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1198,16 +1177,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1216,19 +1192,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1236,31 +1204,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1281,29 +1240,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1317,13 +1270,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1339,9 +1290,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1349,7 +1297,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1430,17 +1377,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/metrics-opentelemetry/Cargo.lock b/examples/metrics-opentelemetry/Cargo.lock index b880b43b..947ab321 100644 --- a/examples/metrics-opentelemetry/Cargo.lock +++ b/examples/metrics-opentelemetry/Cargo.lock @@ -1342,16 +1342,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1410,17 +1400,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1545,42 +1524,26 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64 0.22.1", - "brotli", "bytes", - "cookie", "envy", - "flate2", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", "mime_guess", - "opentelemetry", - "opentelemetry-otlp", - "opentelemetry_sdk", "parking_lot", "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1588,31 +1551,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64 0.22.1", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1634,14 +1588,12 @@ dependencies = [ "base64 0.22.1", "brotli", "bytes", - "cookie", "flate2", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "opentelemetry", "opentelemetry-otlp", "opentelemetry_sdk", @@ -1650,17 +1602,13 @@ dependencies = [ "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1674,13 +1622,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1711,9 +1657,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1721,7 +1664,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] diff --git a/examples/multipart/Cargo.lock b/examples/multipart/Cargo.lock index f5d1fb3a..7ff28e98 100644 --- a/examples/multipart/Cargo.lock +++ b/examples/multipart/Cargo.lock @@ -1104,17 +1104,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1229,39 +1218,26 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", "mime_guess", - "multer", "parking_lot", "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", - "uuid", ] [[package]] @@ -1269,32 +1245,24 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", "multer", - "parking_lot", "serde", "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", "uuid", ] @@ -1316,29 +1284,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1352,13 +1314,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1374,9 +1334,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1384,7 +1341,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1465,17 +1421,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/openapi-utoipa/Cargo.lock b/examples/openapi-utoipa/Cargo.lock index 61bffcff..0e406b95 100644 --- a/examples/openapi-utoipa/Cargo.lock +++ b/examples/openapi-utoipa/Cargo.lock @@ -1014,16 +1014,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1082,17 +1072,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1212,16 +1191,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1230,19 +1206,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", "utoipa", ] @@ -1251,31 +1219,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1296,29 +1255,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1332,13 +1285,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1354,9 +1305,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1364,7 +1312,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1445,17 +1392,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/openapi/Cargo.lock b/examples/openapi/Cargo.lock index ac2a7821..00ebc751 100644 --- a/examples/openapi/Cargo.lock +++ b/examples/openapi/Cargo.lock @@ -1013,16 +1013,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1081,17 +1071,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1200,16 +1179,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1218,19 +1194,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", "vespera_core", ] @@ -1239,31 +1207,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1284,29 +1243,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1320,13 +1273,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1342,9 +1293,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1352,7 +1300,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1433,17 +1380,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/proxy-protocol/Cargo.lock b/examples/proxy-protocol/Cargo.lock index 73b31aab..6301d567 100644 --- a/examples/proxy-protocol/Cargo.lock +++ b/examples/proxy-protocol/Cargo.lock @@ -1044,16 +1044,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1112,17 +1102,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1240,16 +1219,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1258,19 +1234,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1278,31 +1246,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1323,29 +1282,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1360,13 +1313,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1382,9 +1333,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1392,7 +1340,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1473,17 +1420,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/raw-quic/Cargo.lock b/examples/raw-quic/Cargo.lock index 9865103e..eca498c5 100644 --- a/examples/raw-quic/Cargo.lock +++ b/examples/raw-quic/Cargo.lock @@ -2036,16 +2036,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -2291,42 +2281,27 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", - "h3", - "h3-quinn", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", "mime_guess", "parking_lot", "pin-project-lite", - "quinn", "rustls", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-rustls", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -2334,31 +2309,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -2379,29 +2345,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -2419,7 +2379,6 @@ dependencies = [ "h3-quinn", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", @@ -2428,7 +2387,6 @@ dependencies = [ "tako-rs-core", "tokio", "tokio-rustls", - "tokio-stream", "tokio-util", "tracing", ] @@ -2444,9 +2402,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2456,7 +2411,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -2611,17 +2565,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/signals-advanced/Cargo.lock b/examples/signals-advanced/Cargo.lock index be56d5ce..7eeab325 100644 --- a/examples/signals-advanced/Cargo.lock +++ b/examples/signals-advanced/Cargo.lock @@ -1028,16 +1028,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1096,17 +1086,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1225,16 +1204,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1243,19 +1219,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1263,31 +1231,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1308,29 +1267,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1344,13 +1297,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1381,9 +1332,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1391,7 +1339,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1472,17 +1419,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/signals-advanced/src/main.rs b/examples/signals-advanced/src/main.rs index b589b234..ef22d801 100644 --- a/examples/signals-advanced/src/main.rs +++ b/examples/signals-advanced/src/main.rs @@ -9,7 +9,7 @@ use tako::router::Router; use tako::signals::Signal; use tako::signals::SignalArbiter; use tako::signals::SignalPayload; -use tako::signals::app_events; +use tako::signals::app_signals; use tako::signals::ids; use tako::types::BuildHasher; use tokio::net::TcpListener; @@ -117,7 +117,7 @@ async fn route_with_signals(State(arbiter): State) -> impl Respon } fn init_app_signals() { - let arbiter = app_events(); + let arbiter = app_signals(); // Configure broadcast capacity SignalArbiter::set_global_broadcast_capacity(128); @@ -141,11 +141,6 @@ fn init_app_signals() { println!("[advanced][handler] {} -> {:?}", signal.id, signal.metadata); }); - // RPC error events - arbiter.on(ids::RPC_ERROR, |signal: Signal| async move { - println!("[advanced][rpc_error] {:?}", signal.metadata); - }); - // Prefix subscription for all request.* signals let mut prefix_rx = arbiter.subscribe_prefix("request."); tokio::spawn(async move { diff --git a/examples/signals-basic/Cargo.lock b/examples/signals-basic/Cargo.lock index bc07401c..7f884111 100644 --- a/examples/signals-basic/Cargo.lock +++ b/examples/signals-basic/Cargo.lock @@ -1028,16 +1028,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1096,17 +1086,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1225,16 +1204,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1243,19 +1219,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1263,31 +1231,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1308,29 +1267,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1344,13 +1297,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1381,9 +1332,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1391,7 +1339,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1472,17 +1419,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/signals-basic/src/main.rs b/examples/signals-basic/src/main.rs index 872773ac..9581f472 100644 --- a/examples/signals-basic/src/main.rs +++ b/examples/signals-basic/src/main.rs @@ -3,7 +3,7 @@ use tako::Method; use tako::responder::Responder; use tako::router::Router; use tako::signals::Signal; -use tako::signals::app_events; +use tako::signals::app_signals; use tako::signals::ids; use tako::types::Request; use tokio::net::TcpListener; @@ -13,7 +13,7 @@ async fn hello(_: Request) -> impl Responder { } fn init_signals() { - let arbiter = app_events(); + let arbiter = app_signals(); // Simple callback-style handler for server start arbiter.on(ids::SERVER_STARTED, |signal: Signal| async move { diff --git a/examples/signals-complex/Cargo.lock b/examples/signals-complex/Cargo.lock index be72756e..b51ed274 100644 --- a/examples/signals-complex/Cargo.lock +++ b/examples/signals-complex/Cargo.lock @@ -1028,16 +1028,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1096,17 +1086,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1225,16 +1204,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1243,19 +1219,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1263,31 +1231,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1308,29 +1267,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1344,13 +1297,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1381,9 +1332,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1391,7 +1339,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1472,17 +1419,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/signals-complex/src/main.rs b/examples/signals-complex/src/main.rs index f6647225..2a37d58e 100644 --- a/examples/signals-complex/src/main.rs +++ b/examples/signals-complex/src/main.rs @@ -8,7 +8,7 @@ use tako::responder::Responder; use tako::router::Router; use tako::signals::Signal; use tako::signals::SignalArbiter; -use tako::signals::app_events; +use tako::signals::app_signals; use tako::signals::ids; use tako::types::BuildHasher; use tokio::net::TcpListener; @@ -50,7 +50,7 @@ async fn trigger_hot_reload() -> impl Responder { } fn init_app_signals() { - let arbiter = app_events(); + let arbiter = app_signals(); // Log when server starts arbiter.on(ids::SERVER_STARTED, |signal: Signal| async move { @@ -72,7 +72,7 @@ fn init_app_signals() { }); // Wait once for router.hot_reload, then log - let arbiter_once = app_events().clone(); + let arbiter_once = app_signals().clone(); tokio::spawn(async move { if let Some(signal) = arbiter_once.once(ids::ROUTER_HOT_RELOAD).await { println!("[signals-complex] router.hot_reload: {:?}", signal.metadata); diff --git a/examples/signals-route/Cargo.lock b/examples/signals-route/Cargo.lock index f72e74ec..152ada5c 100644 --- a/examples/signals-route/Cargo.lock +++ b/examples/signals-route/Cargo.lock @@ -1028,16 +1028,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1096,17 +1086,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1225,16 +1204,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1243,19 +1219,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1263,31 +1231,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1308,29 +1267,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1344,13 +1297,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1381,9 +1332,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1391,7 +1339,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1472,17 +1419,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/signals-rpc/Cargo.lock b/examples/signals-rpc/Cargo.lock index ac4a88f8..3c3169cd 100644 --- a/examples/signals-rpc/Cargo.lock +++ b/examples/signals-rpc/Cargo.lock @@ -1028,16 +1028,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1096,17 +1086,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1225,16 +1204,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1243,19 +1219,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1263,31 +1231,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1308,29 +1267,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1344,13 +1297,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1381,9 +1332,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1391,7 +1339,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1472,17 +1419,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/stream-compression/Cargo.lock b/examples/stream-compression/Cargo.lock index 6bbdc451..5aa7b47d 100644 --- a/examples/stream-compression/Cargo.lock +++ b/examples/stream-compression/Cargo.lock @@ -1099,16 +1099,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1167,17 +1157,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1302,18 +1281,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", - "brotli", "bytes", - "cookie", "envy", - "flate2", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1322,19 +1296,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1342,31 +1308,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1388,30 +1345,24 @@ dependencies = [ "base64", "brotli", "bytes", - "cookie", "flate2", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1425,13 +1376,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1462,9 +1411,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1472,7 +1418,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1553,17 +1498,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/streams-compio/Cargo.lock b/examples/streams-compio/Cargo.lock index 0468f1a5..8f96501e 100644 --- a/examples/streams-compio/Cargo.lock +++ b/examples/streams-compio/Cargo.lock @@ -1661,16 +1661,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1924,18 +1914,14 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", "compio", - "cookie", - "cyper-core", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1945,19 +1931,11 @@ dependencies = [ "scc", "send_wrapper", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1965,31 +1943,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -2011,30 +1980,24 @@ dependencies = [ "base64", "bytes", "compio", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "send_wrapper", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -2050,14 +2013,12 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "send_wrapper", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -2072,7 +2033,6 @@ dependencies = [ "futures-util", "hyper", "hyper-util", - "send_wrapper", "socket2", "tako-rs-core", "tokio", @@ -2092,9 +2052,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2103,7 +2060,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -2212,17 +2168,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/streams/Cargo.lock b/examples/streams/Cargo.lock index a1311377..0e88fc6c 100644 --- a/examples/streams/Cargo.lock +++ b/examples/streams/Cargo.lock @@ -1001,16 +1001,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1069,17 +1059,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1202,16 +1181,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1220,19 +1196,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1240,31 +1208,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1285,29 +1244,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1321,13 +1274,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1343,9 +1294,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1353,7 +1301,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1434,17 +1381,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/tcp-echo/Cargo.lock b/examples/tcp-echo/Cargo.lock index 0404f156..1db4bdb8 100644 --- a/examples/tcp-echo/Cargo.lock +++ b/examples/tcp-echo/Cargo.lock @@ -1016,16 +1016,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1084,17 +1074,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1212,16 +1191,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1230,19 +1206,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1250,31 +1218,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1295,29 +1254,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1331,13 +1284,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1353,9 +1304,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1363,7 +1311,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1454,17 +1401,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/tls-compio/Cargo.lock b/examples/tls-compio/Cargo.lock index c0aa26ac..dd4236ca 100644 --- a/examples/tls-compio/Cargo.lock +++ b/examples/tls-compio/Cargo.lock @@ -1725,16 +1725,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1975,18 +1965,14 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", "compio", - "cookie", - "cyper-core", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1997,20 +1983,11 @@ dependencies = [ "scc", "send_wrapper", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-rustls", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -2018,31 +1995,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -2064,30 +2032,24 @@ dependencies = [ "base64", "bytes", "compio", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "send_wrapper", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -2103,7 +2065,6 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", @@ -2112,7 +2073,6 @@ dependencies = [ "tako-rs-core", "tokio", "tokio-rustls", - "tokio-stream", "tokio-util", "tracing", ] @@ -2127,7 +2087,6 @@ dependencies = [ "futures-util", "hyper", "hyper-util", - "send_wrapper", "socket2", "tako-rs-core", "tokio", @@ -2147,9 +2106,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2158,7 +2114,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -2287,17 +2242,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/typed-routes/Cargo.lock b/examples/typed-routes/Cargo.lock index e45e93f8..aa06025a 100644 --- a/examples/typed-routes/Cargo.lock +++ b/examples/typed-routes/Cargo.lock @@ -998,16 +998,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1066,17 +1056,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1185,16 +1164,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1203,19 +1179,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1223,31 +1191,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1268,29 +1227,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1304,13 +1257,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1326,9 +1277,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1336,7 +1284,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1417,17 +1364,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/udp-echo/Cargo.lock b/examples/udp-echo/Cargo.lock index 978784b1..1a69bb92 100644 --- a/examples/udp-echo/Cargo.lock +++ b/examples/udp-echo/Cargo.lock @@ -1016,16 +1016,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1084,17 +1074,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1212,16 +1191,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1230,19 +1206,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1250,31 +1218,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1295,29 +1254,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1331,13 +1284,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1353,9 +1304,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1363,7 +1311,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1444,17 +1391,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/unix-socket/Cargo.lock b/examples/unix-socket/Cargo.lock index e388bb2b..4794660f 100644 --- a/examples/unix-socket/Cargo.lock +++ b/examples/unix-socket/Cargo.lock @@ -1016,16 +1016,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1084,17 +1074,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1212,16 +1191,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1230,19 +1206,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1250,31 +1218,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1295,29 +1254,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1331,13 +1284,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1353,9 +1304,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1363,7 +1311,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1444,17 +1391,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/upload-progress/Cargo.lock b/examples/upload-progress/Cargo.lock index 7d24383e..5ef8eb62 100644 --- a/examples/upload-progress/Cargo.lock +++ b/examples/upload-progress/Cargo.lock @@ -1016,16 +1016,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1084,17 +1074,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1212,16 +1191,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1230,19 +1206,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1250,31 +1218,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1295,29 +1254,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1331,13 +1284,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1353,9 +1304,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1363,7 +1311,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1444,17 +1391,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/websocket-compio/Cargo.lock b/examples/websocket-compio/Cargo.lock index 111a96f1..a0de2874 100644 --- a/examples/websocket-compio/Cargo.lock +++ b/examples/websocket-compio/Cargo.lock @@ -1661,16 +1661,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1914,15 +1904,12 @@ dependencies = [ "base64", "bytes", "compio", - "cookie", - "cyper-core", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1932,19 +1919,13 @@ dependencies = [ "scc", "send_wrapper", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", "url", - "urlencoding", ] [[package]] @@ -1952,31 +1933,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1998,30 +1970,24 @@ dependencies = [ "base64", "bytes", "compio", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "send_wrapper", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -2037,14 +2003,12 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "send_wrapper", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -2059,7 +2023,6 @@ dependencies = [ "futures-util", "hyper", "hyper-util", - "send_wrapper", "socket2", "tako-rs-core", "tokio", @@ -2079,9 +2042,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2198,17 +2158,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/websocket-tls/Cargo.lock b/examples/websocket-tls/Cargo.lock index d8ea4c9e..4e7f043d 100644 --- a/examples/websocket-tls/Cargo.lock +++ b/examples/websocket-tls/Cargo.lock @@ -1148,16 +1148,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1343,14 +1333,12 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1360,20 +1348,13 @@ dependencies = [ "rustls", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-rustls", - "tokio-stream", - "tokio-util", "tracing", "url", - "urlencoding", ] [[package]] @@ -1381,31 +1362,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1426,29 +1398,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1462,7 +1428,6 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", @@ -1470,7 +1435,6 @@ dependencies = [ "tako-rs-core", "tokio", "tokio-rustls", - "tokio-stream", "tokio-util", "tracing", ] @@ -1486,9 +1450,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1586,17 +1547,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/websocket/Cargo.lock b/examples/websocket/Cargo.lock index 1308dd7c..dc5cd76a 100644 --- a/examples/websocket/Cargo.lock +++ b/examples/websocket/Cargo.lock @@ -1002,16 +1002,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1191,14 +1181,12 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1207,19 +1195,13 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", "url", - "urlencoding", ] [[package]] @@ -1227,31 +1209,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1272,29 +1245,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1308,13 +1275,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1330,9 +1295,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1420,17 +1382,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/examples/webtransport/Cargo.lock b/examples/webtransport/Cargo.lock index 180993aa..0487d401 100644 --- a/examples/webtransport/Cargo.lock +++ b/examples/webtransport/Cargo.lock @@ -2222,16 +2222,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.229" @@ -2504,42 +2494,27 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64 0.22.1", "bytes", - "cookie", "envy", "futures-util", - "h3", - "h3-quinn", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", "mime_guess", "parking_lot", "pin-project-lite", - "quinn", "rustls", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-rustls", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -2547,31 +2522,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64 0.22.1", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -2592,29 +2558,23 @@ dependencies = [ "async-trait", "base64 0.22.1", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -2632,7 +2592,6 @@ dependencies = [ "h3-quinn", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", @@ -2641,7 +2600,6 @@ dependencies = [ "tako-rs-core", "tokio", "tokio-rustls", - "tokio-stream", "tokio-util", "tracing", ] @@ -2657,9 +2615,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -2669,7 +2624,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -2794,17 +2748,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.19" diff --git a/examples/with-state/Cargo.lock b/examples/with-state/Cargo.lock index 018c801b..cf96b4ab 100644 --- a/examples/with-state/Cargo.lock +++ b/examples/with-state/Cargo.lock @@ -1001,16 +1001,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -1069,17 +1059,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.10.9" @@ -1188,16 +1167,13 @@ dependencies = [ "anyhow", "arc-swap", "async-trait", - "base64", "bytes", - "cookie", "envy", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1206,19 +1182,11 @@ dependencies = [ "pin-project-lite", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", - "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", - "url", - "urlencoding", ] [[package]] @@ -1226,31 +1194,22 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", - "parking_lot", "serde", - "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", ] @@ -1271,29 +1230,23 @@ dependencies = [ "async-trait", "base64", "bytes", - "cookie", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1307,13 +1260,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1329,9 +1280,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1339,7 +1287,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "url", ] [[package]] @@ -1420,17 +1367,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.18" diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 15459084..9371531c 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -1385,17 +1385,13 @@ dependencies = [ "arc-swap", "async-trait", "base64", - "brotli", "bytes", - "cookie", "envy", - "flate2", "futures-util", "http", "http-body", "http-body-util", "hyper", - "hyper-util", "linkme", "matchit", "mime", @@ -1405,19 +1401,13 @@ dependencies = [ "prost", "scc", "serde", - "serde_bytes", "serde_json", - "serde_urlencoded", "sha1", - "sha2 0.11.0", "smallvec", "thread_local", "tokio", - "tokio-stream", - "tokio-util", "tracing", "url", - "urlencoding", ] [[package]] @@ -1425,32 +1415,24 @@ name = "tako-rs-extractors" version = "2.4.2" dependencies = [ "anyhow", - "async-trait", "base64", "bytes", "cookie", "futures-util", "hkdf", "http", - "http-body", "http-body-util", "ipnet", "mime", - "mime_guess", "multer", - "parking_lot", "serde", "serde_bytes", "serde_html_form", "serde_json", "serde_urlencoded", - "sha1", "sha2 0.11.0", - "smallvec", "tako-rs-core", "tokio", - "tracing", - "url", "urlencoding", "uuid", ] @@ -1464,30 +1446,24 @@ dependencies = [ "base64", "brotli", "bytes", - "cookie", "flate2", "futures-util", "http", "http-body", "http-body-util", "httpdate", - "mime", "parking_lot", "pin-project-lite", "scc", "serde", "serde_json", - "sha1", "sha2 0.11.0", - "smallvec", "subtle", "tako-rs-core", "tako-rs-extractors", "tokio", - "tokio-stream", "tracing", "url", - "urlencoding", "uuid", ] @@ -1502,13 +1478,11 @@ dependencies = [ "futures-util", "http", "http-body", - "http-body-util", "hyper", "hyper-util", "pin-project-lite", "tako-rs-core", "tokio", - "tokio-stream", "tokio-util", "tracing", ] @@ -1524,9 +1498,6 @@ dependencies = [ "http-body", "http-body-util", "httpdate", - "hyper", - "hyper-util", - "mime", "mime_guess", "percent-encoding", "pin-project-lite", @@ -1612,17 +1583,6 @@ dependencies = [ "syn 3.0.6", ] -[[package]] -name = "tokio-stream" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.19" diff --git a/tako-rs-core/Cargo.toml b/tako-rs-core/Cargo.toml index 161718c0..34ddc293 100644 --- a/tako-rs-core/Cargo.toml +++ b/tako-rs-core/Cargo.toml @@ -21,99 +21,66 @@ anyhow = { workspace = true } arc-swap = { workspace = true } async-graphql = { workspace = true, optional = true } async-trait = { workspace = true } -base64 = { workspace = true } -brotli = { workspace = true, optional = true } +base64 = { workspace = true, optional = true } bytes = { workspace = true } chrono = { workspace = true, optional = true } compio = { workspace = true, optional = true } -cookie = { workspace = true } cron = { workspace = true, optional = true } -cyper-core = { workspace = true, optional = true } envy = { workspace = true } -flate2 = { workspace = true, optional = true } futures-util = { workspace = true } -h3 = { workspace = true, optional = true } -h3-quinn = { workspace = true, optional = true } http = { workspace = true } http-body = { workspace = true } http-body-util = { workspace = true } hyper = { workspace = true } -hyper-util = { workspace = true } linkme = { workspace = true } matchit = { workspace = true } mime = { workspace = true } mime_guess = { workspace = true } -multer = { workspace = true, optional = true } -opentelemetry = { workspace = true, optional = true } -opentelemetry-otlp = { workspace = true, optional = true } -opentelemetry_sdk = { workspace = true, optional = true } parking_lot = { workspace = true } pin-project-lite = { workspace = true } -prometheus = { workspace = true, optional = true } prost = { workspace = true, optional = true } -quinn = { workspace = true, optional = true } rustls = { workspace = true, optional = true } scc = { workspace = true } send_wrapper = { workspace = true, optional = true } serde = { workspace = true } -serde_bytes = { workspace = true } serde_json = { workspace = true } -serde_urlencoded = { workspace = true } -sha1 = { workspace = true } -sha2 = { workspace = true } -simd-json = { workspace = true, optional = true } +sha1 = { workspace = true, optional = true } +sha2 = { workspace = true, optional = true } smallvec = { workspace = true } sonic-rs = { workspace = true, optional = true } thread_local = { workspace = true } tokio = { workspace = true } -tokio-rustls = { workspace = true, optional = true } -tokio-stream = { workspace = true } -tokio-util = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true, optional = true } -url = { workspace = true } -urlencoding = { workspace = true } +url = { workspace = true, optional = true } utoipa = { workspace = true, optional = true } -uuid = { workspace = true, optional = true } vespera_core = { workspace = true, optional = true } -zstd = { workspace = true, optional = true } - -[target.'cfg(target_os = "freebsd")'.dependencies] -jwt-simple = { workspace = true, features = ["pure-rust"], optional = true, default-features = false } - -[target.'cfg(not(target_os = "freebsd"))'.dependencies] -jwt-simple = { workspace = true, optional = true, features = ["default"] } [features] -async-graphql = ["tako-rs/async-graphql", "dep:async-graphql"] -compio = ["tako-rs/compio", "dep:compio", "dep:cyper-core", "dep:send_wrapper"] +async-graphql = ["tako-rs/async-graphql", "dep:async-graphql", "dep:sha2"] +compio = ["tako-rs/compio", "dep:compio", "dep:send_wrapper"] compio-tls = ["tako-rs/compio-tls", "compio", "tls", "dep:rustls"] -metrics-prometheus = ["tako-rs/metrics-prometheus", "dep:prometheus", "plugins", "signals"] -metrics-opentelemetry = ["tako-rs/metrics-opentelemetry", "dep:opentelemetry", "dep:opentelemetry_sdk", "dep:opentelemetry-otlp", "plugins", "signals"] +metrics-prometheus = ["tako-rs/metrics-prometheus", "plugins", "signals"] +metrics-opentelemetry = ["tako-rs/metrics-opentelemetry", "plugins", "signals"] graphiql = ["tako-rs/graphiql", "dep:async-graphql", "async-graphql/graphiql"] default = [] -ws = ["tako-rs/ws", "futures-util/sink", "hyper/http1", "hyper/server"] +ws = ["tako-rs/ws", "dep:base64", "dep:sha1", "dep:url", "futures-util/sink", "hyper/http1", "hyper/server"] file-stream = ["tako-rs/file-stream"] -http2 = ["tako-rs/http2", "hyper/http2", "hyper-util/http2"] +http2 = ["tako-rs/http2", "hyper/http2"] jemalloc = ["tako-rs/jemalloc"] -multipart = ["tako-rs/multipart", "dep:multer", "dep:uuid"] -plugins = ["tako-rs/plugins", "dep:brotli", "dep:flate2"] +multipart = ["tako-rs/multipart"] +plugins = ["tako-rs/plugins"] protobuf = ["tako-rs/protobuf", "dep:prost"] signals = ["tako-rs/signals"] -# `simd` is a meta-feature enabling both SIMD JSON backends. Prefer the -# split features below when you only need one backend — they shrink the -# binary by skipping the unused SIMD parser. +# Both SIMD JSON backends; the split features below skip the unused parser. simd = ["tako-rs/simd", "simd-sonic", "simd-json-impl"] -# Enables the `sonic-rs` backend used by the built-in `Json` extractor's -# SIMD fast path. (Without this, `Json` falls back to `serde_json`.) +# The `sonic-rs` fast path of `Json`, which otherwise uses `serde_json`. simd-sonic = ["tako-rs/simd-sonic", "dep:sonic-rs"] -# Enables the `simd-json` backend used by the optional `SimdJson` extractor -# re-exported from `tako-extractors`. -simd-json-impl = ["tako-rs/simd-json-impl", "dep:simd-json"] -tls = ["tako-rs/tls", "dep:tokio-rustls", "dep:rustls"] -grpc = ["tako-rs/grpc", "protobuf"] +simd-json-impl = ["tako-rs/simd-json-impl"] +tls = ["tako-rs/tls", "dep:rustls"] +grpc = ["tako-rs/grpc", "protobuf", "dep:base64"] queue-cron = ["tako-rs/queue-cron", "dep:cron", "dep:chrono"] -http3 = ["tako-rs/http3", "dep:h3", "dep:h3-quinn", "dep:quinn", "dep:rustls"] +http3 = ["tako-rs/http3", "dep:rustls"] webtransport = ["tako-rs/webtransport", "http3"] ahash = ["tako-rs/ahash", "dep:ahash"] tako-tracing = ["tako-rs/tako-tracing", "dep:tracing-subscriber"] @@ -121,8 +88,8 @@ utoipa = ["tako-rs/utoipa", "dep:utoipa"] utoipa-yaml = ["tako-rs/utoipa-yaml", "utoipa", "utoipa/yaml"] vespera = ["tako-rs/vespera", "dep:vespera_core"] zero-copy-extractors = ["tako-rs/zero-copy-extractors"] -jwt-simple = ["tako-rs/jwt-simple", "dep:jwt-simple"] -zstd = ["tako-rs/zstd", "dep:zstd", "plugins"] +jwt-simple = ["tako-rs/jwt-simple"] +zstd = ["tako-rs/zstd", "plugins"] [package.metadata.docs.rs] all-features = true @@ -130,6 +97,7 @@ rustdoc-args = ["--cfg", "docsrs"] [dev-dependencies] criterion = { workspace = true } +hyper-util = { workspace = true } tako-rs = { workspace = true } tokio = { workspace = true, features = ["macros", "rt-multi-thread", "test-util"] } diff --git a/tako-rs-core/benches/json_extract.rs b/tako-rs-core/benches/json_extract.rs index ee76d580..4b6d5f2c 100644 --- a/tako-rs-core/benches/json_extract.rs +++ b/tako-rs-core/benches/json_extract.rs @@ -1,6 +1,4 @@ //! Hot-path bench: `Json` extraction across the simd/serde split. -//! -//! Run with: `cargo bench -p tako-core --bench json_extract`. use std::hint::black_box; diff --git a/tako-rs-core/benches/router_dispatch.rs b/tako-rs-core/benches/router_dispatch.rs index be705ff9..9cdbd32c 100644 --- a/tako-rs-core/benches/router_dispatch.rs +++ b/tako-rs-core/benches/router_dispatch.rs @@ -1,6 +1,4 @@ //! Hot-path bench: router dispatch for static and dynamic paths. -//! -//! Run with: `cargo bench -p tako-rs-core --bench router_dispatch`. use std::hint::black_box; diff --git a/tako-rs-core/src/body.rs b/tako-rs-core/src/body.rs index f79e4280..130184d9 100644 --- a/tako-rs-core/src/body.rs +++ b/tako-rs-core/src/body.rs @@ -1,10 +1,4 @@ -//! HTTP request and response body handling utilities for efficient data processing. -//! -//! This module provides `TakoBody`, a flexible wrapper around HTTP body implementations -//! that supports various data sources including static content, streams, and dynamic -//! generation. It integrates with Hyper's body system while providing convenience methods -//! for common use cases like creating empty bodies, streaming data, and converting from -//! different input types with efficient memory management. +//! [`TakoBody`], the body of every request and response. //! //! # Examples //! @@ -36,7 +30,6 @@ use std::pin::Pin; use std::task::Context; use std::task::Poll; -use anyhow::Result; use bytes::Bytes; use futures_util::Stream; use futures_util::TryStream; @@ -52,25 +45,15 @@ use http_body_util::StreamBody; use crate::types::BoxBody; use crate::types::BoxError; -/// Internal enum to avoid heap-boxing for the most common body kinds. -/// `Full`, `Empty`, and `Incoming` are stored inline (zero allocations). -/// Anything else (streams, mapped bodies, etc.) goes through the `Boxed` variant. -#[allow(dead_code)] +/// `Full`, `Empty` and hyper's `Incoming` are stored unboxed; any other body is boxed. enum BodyInner { Full(Full), Empty(Empty), - /// Hyper's incoming request body — stored inline to avoid boxing on every request. Incoming(hyper::body::Incoming), Boxed(BoxBody), } -/// HTTP body wrapper with streaming and conversion support. -/// -/// `TakoBody` provides a unified interface for handling HTTP request and response bodies -/// with support for various data sources. It wraps Hyper's body system with additional -/// convenience methods and efficient conversion capabilities. The implementation supports -/// both static content and streaming data while maintaining performance through zero-copy -/// operations where possible. +/// Request and response body; buffered, empty and incoming bodies are not boxed. /// /// # Examples /// @@ -124,10 +107,7 @@ impl TakoBody { matches!(self.0, BodyInner::Full(_) | BodyInner::Empty(_)) } - /// Creates a new body from any type implementing the `Body` trait. - /// - /// This is the generic (boxing) path — prefer [`full`](Self::full) or - /// [`empty`](Self::empty) when the concrete type is known. + /// Boxes any `Body`; prefer [`full`](Self::full) or [`empty`](Self::empty) where they fit. #[inline] pub fn new(body: B) -> Self where @@ -183,7 +163,6 @@ impl TakoBody { } } -/// Provides a default empty body implementation. impl Default for TakoBody { fn default() -> Self { Self::empty() @@ -223,16 +202,15 @@ impl From for TakoBody { /// Converts an `Infallible` poll result into a `BoxError` poll result at zero cost. #[inline] fn map_infallible_frame( - poll: Poll, Infallible>>>, -) -> Poll, BoxError>>> { + poll: Poll, Infallible>>>, +) -> Poll, BoxError>>> { poll.map(|opt| opt.map(|res| res.map_err(|e| match e {}))) } -/// Converts a `hyper::Error` poll result into a `BoxError` poll result. #[inline] fn map_hyper_frame( - poll: Poll, hyper::Error>>>, -) -> Poll, BoxError>>> { + poll: Poll, hyper::Error>>>, +) -> Poll, BoxError>>> { poll.map(|opt| opt.map(|res| res.map_err(Into::into))) } @@ -244,7 +222,7 @@ impl Body for TakoBody { fn poll_frame( self: Pin<&mut Self>, cx: &mut Context<'_>, - ) -> Poll, Self::Error>>> { + ) -> Poll, Self::Error>>> { // All variants are Unpin, so get_mut is safe. match &mut self.get_mut().0 { BodyInner::Full(body) => map_infallible_frame(Pin::new(body).poll_frame(cx)), diff --git a/tako-rs-core/src/config.rs b/tako-rs-core/src/config.rs index dead15f1..95b78d3e 100644 --- a/tako-rs-core/src/config.rs +++ b/tako-rs-core/src/config.rs @@ -1,7 +1,4 @@ -//! Configuration loading from environment variables. -//! -//! Provides a `Config` wrapper that can be loaded from environment variables -//! and injected as router state for access in handlers. +//! [`Config`], typed configuration loaded from environment variables. //! //! # Examples //! @@ -22,31 +19,19 @@ use serde::de::DeserializeOwned; -/// A typed configuration wrapper loaded from environment variables. -/// -/// `Config` reads environment variables and deserializes them into a -/// strongly-typed struct. Variable names are matched by converting struct field names -/// to `SCREAMING_SNAKE_CASE`. +/// `T` deserialized from environment variables named after its fields. #[derive(Debug, Clone)] pub struct Config(pub T); impl Config { - /// Loads configuration from environment variables. - /// - /// Field names are matched against environment variable names case-insensitively - /// (`database_url` ↔ `DATABASE_URL`). Non-string fields (`u16`, `bool`, …) are - /// parsed via the `envy` crate's per-field deserializers, so a typed - /// `port: u16` reads `PORT=8080` natively without relying on JSON number - /// coercion (which the previous serde_json-roundtrip implementation got wrong). + /// Matches variables to fields ignoring case (`DATABASE_URL` fills `database_url`) and + /// parses typed fields such as `port: u16` directly. pub fn from_env() -> Result { let config: T = envy::from_env::().map_err(|e| ConfigError(e.to_string()))?; Ok(Config(config)) } - /// Loads configuration from environment variables that share a common prefix. - /// - /// Useful when several configs coexist in the process — set - /// `MYAPP_DATABASE_URL`, `MYAPP_PORT`, … and call `Config::from_env_prefixed("MYAPP_")`. + /// [`Config::from_env`] over variables named `prefix` plus the field, e.g. `MYAPP_PORT`. pub fn from_env_prefixed(prefix: &str) -> Result { let config: T = envy::prefixed(prefix) .from_env::() @@ -54,23 +39,20 @@ impl Config { Ok(Config(config)) } - /// Creates a Config from an existing value. pub fn new(config: T) -> Self { Config(config) } - /// Returns a reference to the inner config value. pub fn inner(&self) -> &T { &self.0 } - /// Consumes the wrapper and returns the inner value. pub fn into_inner(self) -> T { self.0 } } -/// Error type for configuration loading. +/// Why loading a [`Config`] failed, as reported by `envy`. #[derive(Debug, Clone)] pub struct ConfigError(pub String); diff --git a/tako-rs-core/src/conn_info.rs b/tako-rs-core/src/conn_info.rs index e954d9f2..466f3b06 100644 --- a/tako-rs-core/src/conn_info.rs +++ b/tako-rs-core/src/conn_info.rs @@ -1,12 +1,5 @@ -//! Unified connection-info extension shared by every Tako transport. -//! -//! Every `serve_*` implementation inserts a [`ConnInfo`](crate::conn_info::ConnInfo) into the request's -//! extensions before dispatch, so handlers and middleware can read peer / TLS -//! metadata without branching on transport-specific extension types -//! (`SocketAddr`, `UnixPeerAddr`, `ProxyHeader`, …). -//! -//! Existing extension inserts (`SocketAddr`, `UnixPeerAddr`, `ProxyHeader`) -//! remain in place for backward compatibility — the new struct is additive. +//! [`ConnInfo`], which every transport adds to request extensions next to its own entries, +//! such as `SocketAddr` or [`UnixPeerAddr`]. use std::net::SocketAddr; use std::path::PathBuf; @@ -14,7 +7,6 @@ use std::path::PathBuf; /// Network identity of a peer or local endpoint. #[derive(Debug, Clone)] pub enum PeerAddr { - /// IPv4 / IPv6 socket address. Ip(SocketAddr), /// Unix domain socket path (None for unnamed client sockets). Unix(Option), @@ -39,11 +31,10 @@ impl From for PeerAddr { } } -/// Transport that produced the request. Lets handlers branch on plain HTTP/1 -/// vs. TLS / HTTP/2 / HTTP/3 / Unix without keeping a parallel registry. +/// The protocol a request arrived over; TLS is reported separately in [`ConnInfo::tls`]. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Transport { - /// Plain HTTP/1.1 over TCP. + /// HTTP/1.x over TCP, with or without TLS. Http1, /// HTTP/2 (cleartext or via TLS). Http2, @@ -51,8 +42,6 @@ pub enum Transport { Http3, /// HTTP/1.1 over Unix domain socket. Unix, - /// Raw TCP — no HTTP wrapping (custom protocols only). - Tcp, } /// TLS-specific connection metadata. Populated when the connection terminated @@ -73,9 +62,6 @@ pub struct TlsInfo { pub struct ConnInfo { /// Remote (client) endpoint. pub peer: PeerAddr, - /// Local endpoint, if known. - pub local: Option, - /// Transport identifier. pub transport: Transport, /// TLS metadata if the connection was terminated as TLS at this server. pub tls: Option, @@ -87,7 +73,6 @@ impl ConnInfo { pub fn tcp(peer: SocketAddr) -> Self { Self { peer: PeerAddr::Ip(peer), - local: None, transport: Transport::Http1, tls: None, } @@ -98,20 +83,16 @@ impl ConnInfo { pub fn h2_tls(peer: SocketAddr, tls: TlsInfo) -> Self { Self { peer: PeerAddr::Ip(peer), - local: None, transport: Transport::Http2, tls: Some(tls), } } - /// Helper for HTTP/2 cleartext (prior-knowledge) connections — h2c. No TLS, - /// but the wire protocol is HTTP/2 not HTTP/1, so observability and policy - /// hooks that key on `Transport` must distinguish the two. + /// Helper for cleartext HTTP/2 (h2c) connections. #[inline] pub fn h2c(peer: SocketAddr) -> Self { Self { peer: PeerAddr::Ip(peer), - local: None, transport: Transport::Http2, tls: None, } @@ -122,7 +103,6 @@ impl ConnInfo { pub fn h1_tls(peer: SocketAddr, tls: TlsInfo) -> Self { Self { peer: PeerAddr::Ip(peer), - local: None, transport: Transport::Http1, tls: Some(tls), } @@ -133,7 +113,6 @@ impl ConnInfo { pub fn h3(peer: SocketAddr, tls: TlsInfo) -> Self { Self { peer: PeerAddr::Ip(peer), - local: None, transport: Transport::Http3, tls: Some(tls), } @@ -144,7 +123,6 @@ impl ConnInfo { pub fn unix(path: Option) -> Self { Self { peer: PeerAddr::Unix(path), - local: None, transport: Transport::Unix, tls: None, } @@ -153,8 +131,6 @@ impl ConnInfo { /// Peer address of an HTTP-over-Unix-socket connection, inserted into request /// extensions next to [`ConnInfo`] on both runtimes. -/// -/// Handlers read it with `req.extensions().get::()`. #[derive(Debug, Clone)] pub struct UnixPeerAddr { /// The filesystem path of the peer socket, if available. @@ -199,7 +175,6 @@ mod tests { let info = ConnInfo::tcp(addr); assert_eq!(info.transport, Transport::Http1); assert!(info.tls.is_none()); - assert!(info.local.is_none()); assert_eq!(info.peer.as_socket(), Some(&addr)); } @@ -240,13 +215,13 @@ mod tests { let info = ConnInfo::unix(Some(PathBuf::from("/var/run/x.sock"))); assert_eq!(info.transport, Transport::Unix); assert!(info.tls.is_none()); - matches!(info.peer, PeerAddr::Unix(Some(_))); + assert!(matches!(info.peer, PeerAddr::Unix(Some(_)))); } #[test] fn conn_info_unix_helper_without_path() { let info = ConnInfo::unix(None); assert_eq!(info.transport, Transport::Unix); - matches!(info.peer, PeerAddr::Unix(None)); + assert!(matches!(info.peer, PeerAddr::Unix(None))); } } diff --git a/tako-rs-core/src/extractors.rs b/tako-rs-core/src/extractors.rs index 461ed4e6..e3603ea6 100644 --- a/tako-rs-core/src/extractors.rs +++ b/tako-rs-core/src/extractors.rs @@ -1,11 +1,4 @@ -//! HTTP request data extraction utilities and traits. -//! -//! This module provides a comprehensive system for extracting data from HTTP requests in a -//! type-safe and ergonomic way. Extractors can parse various parts of requests including -//! headers, query parameters, JSON/form bodies, cookies, and path parameters. The module -//! defines two core traits: `FromRequest` for extractors that need access to the full -//! request (including body), and `FromRequestParts` for extractors that only need request -//! metadata like headers and URI. +//! [`FromRequest`] and [`FromRequestParts`], plus the extractors whose types the router uses. //! //! # Examples //! @@ -33,7 +26,7 @@ use http::request::Parts; -/// Checks if the Content-Type header indicates JSON content. +/// Whether `Content-Type` is `application/json` or an `application/*+json` type. #[doc(hidden)] pub fn is_json_content_type(headers: &http::HeaderMap) -> bool { headers @@ -47,24 +40,13 @@ pub fn is_json_content_type(headers: &http::HeaderMap) -> bool { } pub mod body; - -/// JSON request body parsing and deserialization. pub mod json; - -/// Path parameter extraction from dynamic route segments. pub mod params; - -/// Range header parsing for partial content requests. pub mod range; - -/// Compile-time-shaped path parameter extractor (paired with `#[tako::route]`). pub mod typed_params; -/// Framework entries the router puts into a request's extensions. -/// -/// Extractors list the entries they read in `ENTRIES`. A route without -/// middleware attaches only what its handler's extractors list; the full -/// pipeline always attaches every entry. +/// Request extensions the router provides; a route without middleware attaches only those +/// its handler's extractors list in `ENTRIES`, the full pipeline all of them. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct Entries(u8); @@ -98,12 +80,7 @@ impl Entries { } } -/// Trait for extracting data from complete HTTP requests. -/// -/// `FromRequest` enables types to extract and parse data from HTTP requests, including -/// access to the request body. This trait is designed for extractors that need to consume -/// or parse the request body, such as JSON deserializers, form parsers, or raw byte -/// extractors. The extraction is asynchronous to support streaming body processing. +/// Extracts a value from the whole request, body included; a handler's last argument is one. /// /// # Examples /// @@ -132,28 +109,19 @@ impl Entries { /// } /// ``` pub trait FromRequest<'a>: Sized { - /// Error type returned when extraction fails. + /// Sent as the response, instead of calling the handler, when extraction fails. type Error: crate::responder::Responder; - /// Framework entries this extractor reads. - /// - /// The default, [`Entries::ALL`], is always correct. A route without - /// middleware attaches only the entries its extractors list, so an entry - /// left out here is missing from those requests. + /// Entries this extractor reads; the default, [`Entries::ALL`], is always correct, while + /// an entry left out is missing on routes without middleware. const ENTRIES: Entries = Entries::ALL; - /// Extracts the type from the HTTP request. fn from_request( req: &'a mut crate::types::Request, ) -> impl core::future::Future> + Send + 'a; } -/// Trait for extracting data from HTTP request parts (metadata only). -/// -/// `FromRequestParts` enables types to extract data from request metadata such as -/// headers, URI, method, and extensions, without needing access to the request body. -/// This is more efficient for extractors that only need metadata and allows multiple -/// extractors to be used on the same request since the body is not consumed. +/// Extracts a value from the request head; every handler argument but the last is one. /// /// # Examples /// @@ -178,30 +146,14 @@ pub trait FromRequest<'a>: Sized { /// } /// ``` pub trait FromRequestParts<'a>: Sized { - /// Error type returned when extraction fails. + /// Sent as the response, instead of calling the handler, when extraction fails. type Error: crate::responder::Responder; - /// Framework entries this extractor reads. - /// - /// The default, [`Entries::ALL`], is always correct. A route without - /// middleware attaches only the entries its extractors list, so an entry - /// left out here is missing from those requests. + /// Entries this extractor reads; the default, [`Entries::ALL`], is always correct, while + /// an entry left out is missing on routes without middleware. const ENTRIES: Entries = Entries::ALL; - /// Extracts the type from the HTTP request parts. fn from_request_parts( parts: &'a mut Parts, ) -> impl core::future::Future> + Send + 'a; } - -// Built-in extractor for borrowing the request itself in handlers: `&mut Request`. -// This enables signatures like `async fn handler(req: &mut Request, Path(..), ...)`. -impl<'a> FromRequest<'a> for &'a mut crate::types::Request { - type Error = core::convert::Infallible; - - fn from_request( - req: &'a mut crate::types::Request, - ) -> impl core::future::Future> + Send + 'a { - futures_util::future::ready(Ok(req)) - } -} diff --git a/tako-rs-core/src/extractors/json.rs b/tako-rs-core/src/extractors/json.rs index 275a5f3b..8569e499 100644 --- a/tako-rs-core/src/extractors/json.rs +++ b/tako-rs-core/src/extractors/json.rs @@ -1,10 +1,4 @@ -//! JSON request body extraction and deserialization for API endpoints. -//! -//! This module provides extractors for parsing JSON request bodies into strongly-typed Rust -//! structures using serde. It validates Content-Type headers, reads request bodies efficiently, -//! and provides detailed error information for malformed JSON or incorrect content types. -//! The extractor integrates seamlessly with serde's derive macros for automatic JSON -//! deserialization of complex data structures. +//! The [`Json`] body extractor and responder. //! //! # Examples //! @@ -45,30 +39,16 @@ use serde::Serialize; use serde::de::DeserializeOwned; use crate::body::TakoBody; +use crate::extractors::Entries; use crate::extractors::FromRequest; use crate::extractors::body::collect_body; +use crate::extractors::is_json_content_type; use crate::responder::Responder; use crate::types::Request; use crate::types::Response; -/// Controls when the SIMD JSON parser is used for `Json` extraction. -/// -/// When the `simd` feature is enabled, `Json` can automatically dispatch to -/// `sonic_rs` for large payloads. This enum lets you override that behavior -/// per-route via [`Route::simd_json`](crate::route::Route::simd_json). -/// -/// If no config is set on a route, the default is `Threshold(2 MB)`. -/// -/// # Security -/// -/// `sonic_rs` is an unsafe-SIMD-heavy JSON parser. Past releases have had -/// bugs around malformed UTF-8 / very long numbers / pathological structures -/// that under certain inputs could be amplified into CPU spikes or panic. -/// For routes that take untrusted JSON from the open internet, prefer -/// `SimdJsonMode::Never` (or pair the route with -/// `tako::extractors::content_length_limit::ContentLengthLimit` to bound the input first). The -/// default `Threshold(2 MB)` keeps small inputs on the `serde_json` path -/// where the attack surface is smaller. +/// When `Json` parses with `sonic-rs` (feature `simd-sonic`), set per route by +/// [`Route::simd_json`](crate::route::Route::simd_json); prefer `Never` for untrusted input. /// /// # Examples /// @@ -93,34 +73,26 @@ pub enum SimdJsonMode { Always, /// Never use the SIMD JSON parser — always fall back to `serde_json`. Never, - /// Use the SIMD JSON parser only when the payload exceeds this many bytes. - /// - /// This is the default behavior with a threshold of 2 MB (2,097,152 bytes). + /// Use the SIMD parser for bodies of at least this many bytes; the default is 2 MiB. Threshold(usize), } impl Default for SimdJsonMode { fn default() -> Self { - Self::Threshold(2 * 1024 * 1024) // 2 MB + Self::Threshold(2 * 1024 * 1024) } } -/// JSON request body extractor with automatic deserialization. +/// Deserializes a JSON request body, or serializes `T` as a JSON response. #[doc(alias = "json")] pub struct Json(pub T); -/// Error types for JSON extraction and deserialization. -/// -/// This error type implements `std::error::Error` for integration with -/// error handling libraries and provides detailed error messages for -/// debugging JSON parsing issues. +/// Why [`Json`] extraction failed; answered with 400, or 413 for an oversized body. #[derive(Debug, Clone, PartialEq, Eq)] pub enum JsonError { /// Content-Type header is not application/json or compatible JSON type. InvalidContentType, - /// Content-Type header is missing from the request. - MissingContentType, - /// Failed to read the request body (network error, timeout, etc.). + /// The body could not be buffered, for example because it exceeds the limit. BodyReadError(crate::extractors::body::BodyReadError), /// JSON deserialization failed (syntax error, type mismatch, etc.). DeserializationError(String), @@ -132,7 +104,6 @@ impl std::fmt::Display for JsonError { Self::InvalidContentType => { write!(f, "invalid content type; expected application/json") } - Self::MissingContentType => write!(f, "missing content type header"), Self::BodyReadError(err) => write!(f, "failed to read request body: {err}"), Self::DeserializationError(err) => write!(f, "failed to deserialize JSON: {err}"), } @@ -142,7 +113,6 @@ impl std::fmt::Display for JsonError { impl std::error::Error for JsonError {} impl Responder for JsonError { - /// Converts JSON extraction errors into appropriate HTTP error responses. fn into_response(self) -> crate::types::Response { match self { JsonError::InvalidContentType => ( @@ -150,9 +120,6 @@ impl Responder for JsonError { "Invalid content type; expected application/json", ) .into_response(), - JsonError::MissingContentType => { - (StatusCode::BAD_REQUEST, "Missing content type header").into_response() - } JsonError::BodyReadError(err) => { (err.status(), format!("Failed to read request body: {err}")).into_response() } @@ -165,9 +132,6 @@ impl Responder for JsonError { } } -use crate::extractors::Entries; -use crate::extractors::is_json_content_type; - impl<'a, T> FromRequest<'a> for Json where T: DeserializeOwned + Send + 'static, @@ -175,24 +139,15 @@ where type Error = JsonError; const ENTRIES: Entries = Entries::BODY_LIMIT.union(Entries::SIMD_JSON); - /// Extracts and deserializes JSON data from the HTTP request body. - /// - /// # Errors - /// - /// Returns [`JsonError`] if: - /// - The Content-Type header is missing or not `application/json`. - /// - The request body cannot be read. - /// - The JSON cannot be deserialized into the target type. + /// Requires a JSON `Content-Type` and a non-empty body. fn from_request( req: &'a mut Request, ) -> impl core::future::Future> + Send + 'a { async move { - // Validate Content-Type header for JSON compatibility if !is_json_content_type(req.headers()) { return Err(JsonError::InvalidContentType); } - // Read the complete request body into memory let body_bytes = collect_body(req).await.map_err(JsonError::BodyReadError)?; if body_bytes.is_empty() { @@ -201,9 +156,6 @@ where )); } - // Deserialize JSON — use the `sonic-rs` SIMD parser when its sub-feature - // is enabled, respecting per-route `SimdJsonMode` configuration. Without - // `simd-sonic` (and therefore without `simd`), fall back to `serde_json`. #[cfg(feature = "simd-sonic")] let data = { let mode = req diff --git a/tako-rs-core/src/extractors/params.rs b/tako-rs-core/src/extractors/params.rs index 00fb8423..6f5ac5f6 100644 --- a/tako-rs-core/src/extractors/params.rs +++ b/tako-rs-core/src/extractors/params.rs @@ -1,10 +1,4 @@ -//! Path parameter extraction and deserialization for dynamic route segments. -//! -//! This module provides extractors for parsing path parameters from dynamic route segments -//! into strongly-typed Rust structures. It handles parameter extraction from routes like -//! `/users/{id}` or `/posts/{post_id}/comments/{comment_id}` and automatically deserializes -//! them using serde. The extractor supports type coercion for common types like integers, -//! floats, and strings, making it easy to work with typed path parameters in handlers. +//! The [`Params`] extractor, which deserializes path parameters with serde. //! //! # Examples //! diff --git a/tako-rs-core/src/extractors/params/decode.rs b/tako-rs-core/src/extractors/params/decode.rs index 9612839c..43141bc2 100644 --- a/tako-rs-core/src/extractors/params/decode.rs +++ b/tako-rs-core/src/extractors/params/decode.rs @@ -7,8 +7,6 @@ use serde::de::{self}; use super::error::PathParamsDeError; -/// Deserializer for a single string value that attempts numeric coercion -/// only when the visitor requests a numeric type. pub(crate) struct ValueDeserializer<'de>(pub(crate) &'de str); impl<'de> Deserializer<'de> for ValueDeserializer<'de> { diff --git a/tako-rs-core/src/extractors/params/deserializer.rs b/tako-rs-core/src/extractors/params/deserializer.rs index 32f3a035..47b2c74f 100644 --- a/tako-rs-core/src/extractors/params/deserializer.rs +++ b/tako-rs-core/src/extractors/params/deserializer.rs @@ -27,9 +27,7 @@ impl<'de> PathParamsDeserializer<'de> { } } -// Trampoline closures preserve the `V` visitor binding through the trait -// method; replacing them with `Trait::method` function refs introduces UFCS -// ambiguity around the generic `V`. +// A method path would need the visitor type spelled out; the closures infer it. #[allow(clippy::redundant_closure_for_method_calls)] impl<'de> Deserializer<'de> for PathParamsDeserializer<'de> { type Error = PathParamsDeError; @@ -55,7 +53,6 @@ impl<'de> Deserializer<'de> for PathParamsDeserializer<'de> { self.deserialize_map(visitor) } - // For single-value extraction (e.g. Params or Params) fn deserialize_newtype_struct>( self, _name: &'static str, @@ -81,10 +78,6 @@ impl<'de> Deserializer<'de> for PathParamsDeserializer<'de> { visitor: V, ) -> Result { if self.0.len() != len { - // Include the captured parameter names so the resulting error points - // the user at the actual mismatch between the route pattern (e.g. - // `/users/{id}/posts/{post_id}` — 2 slots) and the tuple type they - // tried to extract. let captured: Vec<&str> = self.0.iter().map(|(k, _)| k.as_ref()).collect(); return Err(de::Error::custom(format!( "expected tuple of {} path parameters, got {} (captured: [{}])", diff --git a/tako-rs-core/src/extractors/params/error.rs b/tako-rs-core/src/extractors/params/error.rs index dbfa4086..a449b675 100644 --- a/tako-rs-core/src/extractors/params/error.rs +++ b/tako-rs-core/src/extractors/params/error.rs @@ -7,10 +7,7 @@ use serde::de::{self}; use crate::responder::Responder; -/// Error types for path parameter extraction and deserialization. -/// -/// This error type implements `std::error::Error` for integration with -/// error handling libraries. +/// Why [`Params`](crate::extractors::params::Params) extraction failed. #[derive(Debug, Clone, PartialEq, Eq)] pub enum ParamsError { /// Path parameters not found in request extensions (internal routing error). @@ -33,12 +30,7 @@ impl std::fmt::Display for ParamsError { impl std::error::Error for ParamsError {} impl Responder for ParamsError { - /// Converts path parameter errors into appropriate HTTP error responses. - /// - /// `MissingPathParams` is an internal-routing condition (the router did not - /// populate the extension), so the response body is intentionally generic - /// — the detailed framing ("request extensions") stays in the - /// `Display`/`tracing` form so it does not leak through the wire. + /// `MissingPathParams` answers 500 with a generic body that keeps routing details private. fn into_response(self) -> crate::types::Response { match self { ParamsError::MissingPathParams => { @@ -53,7 +45,6 @@ impl Responder for ParamsError { } } -// Custom error type for the deserializer #[derive(Debug)] pub(crate) struct PathParamsDeError(String); @@ -77,9 +68,7 @@ mod tests { #[test] fn params_error_responder_status_codes() { - // Missing PathParams in request extensions is a routing-internal bug, - // so the responder maps it to 500 rather than 400. Deserialization - // failure is caller-visible and stays at 400. + // A missing extension is a routing bug (500); a bad value is the caller's (400). let resp = ParamsError::MissingPathParams.into_response(); assert_eq!(resp.status(), StatusCode::INTERNAL_SERVER_ERROR); let resp = ParamsError::DeserializationError("bad".to_string()).into_response(); diff --git a/tako-rs-core/src/extractors/params/extractor.rs b/tako-rs-core/src/extractors/params/extractor.rs index 05d9df84..63ff453f 100644 --- a/tako-rs-core/src/extractors/params/extractor.rs +++ b/tako-rs-core/src/extractors/params/extractor.rs @@ -10,12 +10,12 @@ use crate::extractors::FromRequest; use crate::extractors::FromRequestParts; use crate::types::Request; -/// Internal helper struct for storing path parameters extracted from routes. +/// The matched parameters as `(name, value)` pairs, in path order. #[derive(Clone, Default)] #[doc(hidden)] pub struct PathParams(pub SmallVec<[(std::sync::Arc, String); 4]>); -/// Path parameter extractor with automatic deserialization to typed structures. +/// Deserializes the matched path parameters into `T`: a struct, a tuple or a single value. #[doc(alias = "params")] pub struct Params(pub T); @@ -51,7 +51,6 @@ impl Params where T: DeserializeOwned, { - /// Extracts and deserializes path parameters from request extensions. fn extract_params(extensions: &http::Extensions) -> Result, ParamsError> { let path_params = extensions .get::() diff --git a/tako-rs-core/src/extractors/range.rs b/tako-rs-core/src/extractors/range.rs index 46cc252e..cabc5d81 100644 --- a/tako-rs-core/src/extractors/range.rs +++ b/tako-rs-core/src/extractors/range.rs @@ -1,16 +1,4 @@ -//! HTTP Range header extraction for partial content requests. -//! -//! Parses RFC 9110 §14.2 `bytes=` Range headers into strongly-typed specs. -//! Three forms are supported per RFC: -//! -//! - `bytes=START-END` — inclusive byte range. -//! - `bytes=START-` — open-ended ("from START to end of representation"). -//! - `bytes=-LENGTH` — suffix ("last LENGTH bytes"). -//! -//! Multi-range requests (`bytes=0-100,200-300`) parse into the full -//! [`Range::specs`](struct.Range.html#structfield.specs) list; responders that -//! only support a single range can call -//! [`Range::single`](struct.Range.html#method.single) to fetch the first spec. +//! RFC 9110 `bytes=` [`Range`] header parsing; extract it as `Option`. use http::HeaderMap; use http::StatusCode; @@ -34,9 +22,7 @@ pub enum RangeSpec { } impl RangeSpec { - /// Resolve a spec against the total representation length, returning the - /// concrete inclusive `[start, end]` byte range or `None` if unsatisfiable - /// (e.g. start >= total, or suffix length 0). + /// The inclusive `(start, end)` byte range within `total_size`, or `None` if unsatisfiable. pub fn resolve(self, total_size: u64) -> Option<(u64, u64)> { if total_size == 0 { return None; @@ -66,7 +52,7 @@ impl RangeSpec { } } -/// Extracted byte range(s) for HTTP partial content requests. +/// A parsed `Range` header. #[derive(Debug, Clone)] #[doc(alias = "range")] pub struct Range { @@ -76,17 +62,14 @@ pub struct Range { } impl Range { - /// Convenience accessor for callers that only support single-range - /// responses — returns the first spec, or `None` if the public `specs` - /// vector has been mutated to empty. (Successful parse always yields at - /// least one spec; see [`Range::from_headers`].) + /// The first spec, for responders that serve a single range. #[must_use] pub fn single(&self) -> Option { self.specs.first().copied() } } -/// Error type for Range header extraction and parsing. +/// Why the `Range` header was rejected; both cases answer 416. #[derive(Debug)] pub enum RangeError { /// Range header format is invalid (not `bytes=...` or contains a @@ -124,12 +107,10 @@ fn parse_one(raw: &str) -> Result { match (start_str.is_empty(), end_str.is_empty()) { (true, true) => Err(RangeError::InvalidFormat), (true, false) => { - // `-LENGTH` — suffix range. let length = end_str.parse::().map_err(|_| RangeError::ParseError)?; Ok(RangeSpec::Suffix { length }) } (false, true) => { - // `START-` — open-ended. let start = start_str .parse::() .map_err(|_| RangeError::ParseError)?; @@ -148,19 +129,12 @@ fn parse_one(raw: &str) -> Result { } } -/// Maximum number of byte-range specs accepted from a single Range header. -/// -/// RFC 9110 §14.2 explicitly permits a server to reject requests "containing -/// many small ranges" — the cap caps amplification on a single header parse -/// (each spec walks the response body) without affecting realistic clients. +/// Most specs accepted in one header, bounding the work per request as RFC 9110 §14.2 allows. pub const MAX_RANGE_SPECS: usize = 100; impl Range { - /// Parses the Range header value in `bytes=start-end[,start-end...]` form. - /// - /// Rejects headers with more than [`MAX_RANGE_SPECS`] entries with - /// [`RangeError::InvalidFormat`] (RFC 9110 §14.2 permits server-side - /// rejection of pathological multi-range requests). + /// Parses `bytes=start-end[,start-end...]`, or returns `Ok(None)` without a header; more + /// than [`MAX_RANGE_SPECS`] specs is [`RangeError::InvalidFormat`]. pub fn from_headers(headers: &HeaderMap) -> Result, RangeError> { let value = match headers.get("range") { Some(v) => v.to_str().map_err(|_| RangeError::InvalidFormat)?, diff --git a/tako-rs-core/src/extractors/typed_params.rs b/tako-rs-core/src/extractors/typed_params.rs index 02460e7a..acfce44a 100644 --- a/tako-rs-core/src/extractors/typed_params.rs +++ b/tako-rs-core/src/extractors/typed_params.rs @@ -1,21 +1,5 @@ -//! Compile-time-shaped path parameter extractor backed by [`FromStr`]. -//! -//! Pair this with the [`#[tako::route]`](https://docs.rs/tako-rs) attribute -//! macro from `tako-macros`: place the attribute on an async handler and the -//! macro generates a sibling struct whose fields exactly mirror the path -//! placeholders, associated `METHOD`/`PATH` consts, and a -//! [`TypedParamsStruct`](crate::extractors::typed_params::TypedParamsStruct) impl that pulls each value from the request's -//! [`PathParams`] extension and parses it via [`core::str::FromStr`]. The -//! struct name defaults to the handler's name in PascalCase plus a `Params` -//! suffix (e.g. `get_user` → `GetUserParams`). -//! -//! Compared to [`Params`](crate::extractors::params::Params), this extractor -//! sidesteps `serde::Deserialize` entirely — the generated impl is direct -//! field-by-field parsing, and parse errors carry the offending field name in -//! the response body. -//! -//! [`PathParams`]: crate::extractors::params::PathParams -//! [`FromStr`]: core::str::FromStr +//! Path parameters parsed field by field with `FromStr` into the struct `#[tako::route]` +//! generates (`get_user` → `GetUserParams`); errors name the offending field. use core::fmt; diff --git a/tako-rs-core/src/graphiql.rs b/tako-rs-core/src/graphiql.rs index 9f4b032e..2864c22e 100644 --- a/tako-rs-core/src/graphiql.rs +++ b/tako-rs-core/src/graphiql.rs @@ -1,9 +1,4 @@ -//! `GraphiQL` HTML responder and helper for Tako. -//! -//! Enable with the `graphiql` feature. This module provides a `graphiql()` function that -//! returns an HTML page rendering the `GraphiQL` UI, wired to your `GraphQL` and WS endpoints. -#![cfg(feature = "graphiql")] -#![cfg_attr(docsrs, doc(cfg(feature = "graphiql")))] +//! `GraphiQL` IDE page for a `GraphQL` endpoint. use http::HeaderValue; use http::header; @@ -12,7 +7,7 @@ use crate::body::TakoBody; use crate::responder::Responder; use crate::types::Response; -/// Response wrapper for `GraphiQL` HTML. +/// The `GraphiQL` HTML page built by [`graphiql`]. pub struct GraphiQL(pub(crate) String); impl Responder for GraphiQL { @@ -26,10 +21,7 @@ impl Responder for GraphiQL { } } -/// Build a `GraphiQL` HTML response. -/// -/// - `endpoint`: HTTP endpoint for `GraphQL` queries/mutations (e.g., "/graphql") -/// - `subscription_endpoint`: optional WS URL for subscriptions (e.g., "") +/// Builds the IDE page for `endpoint`; subscriptions go to the WebSocket `subscription_endpoint`. pub fn graphiql(endpoint: &str, subscription_endpoint: Option<&str>) -> GraphiQL { let mut builder = async_graphql::http::GraphiQLSource::build().endpoint(endpoint); if let Some(ws) = subscription_endpoint { diff --git a/tako-rs-core/src/graphql.rs b/tako-rs-core/src/graphql.rs index f1ecbf8c..df9c9bc8 100644 --- a/tako-rs-core/src/graphql.rs +++ b/tako-rs-core/src/graphql.rs @@ -1,17 +1,8 @@ -//! Async-`GraphQL` integration for Tako: extractors, responses, and subscriptions. +//! `async-graphql` extractors, responders and WebSocket subscriptions. //! -//! - GraphQLRequest / GraphQLBatchRequest extractors -//! - GraphQLResponse / GraphQLBatchResponse responders -//! - GraphQLSubscription responder for WebSocket subscriptions -//! - APQ (Apollo Persisted Queries) and execution-cost limits via submodules +//! # Examples //! -//! Enable via the `async-graphql` cargo feature. -//! -//! # DataLoader integration -//! -//! `async_graphql::dataloader::DataLoader` is the canonical way to batch -//! `Object` field resolvers in N+1 patterns. Tako does not wrap it — instead, -//! attach the loader to per-request `Data` and pull it from the resolver: +//! Tako does not wrap `DataLoader`; attach one to each request's `Data` to batch resolvers: //! //! ```rust,ignore //! use std::sync::Arc; @@ -34,8 +25,6 @@ //! schema.execute(request).await //! ``` //! -//! Field resolver: -//! //! ```rust,ignore //! use async_graphql::Object; //! @@ -52,12 +41,8 @@ //! } //! } //! ``` -#![cfg(feature = "async-graphql")] -#![cfg_attr(docsrs, doc(cfg(feature = "async-graphql")))] -/// Apollo Persisted Queries (APQ) flow. pub mod apq; -/// Execution-cost limits (max depth, max complexity). pub mod limits; mod protocol; @@ -78,8 +63,6 @@ pub use request::MAX_GRAPHQL_BODY_SIZE; pub use request::attach_graphql_options; pub use request::receive_graphql; pub use request::receive_graphql_batch; -#[allow(deprecated)] -pub use request::set_global_graphql_options; pub use response::GraphQLBatchResponse; pub use response::GraphQLResponse; #[cfg(all(feature = "ws", not(feature = "compio")))] diff --git a/tako-rs-core/src/graphql/apq.rs b/tako-rs-core/src/graphql/apq.rs index 9c6d9332..c11b3b06 100644 --- a/tako-rs-core/src/graphql/apq.rs +++ b/tako-rs-core/src/graphql/apq.rs @@ -1,19 +1,5 @@ -//! Apollo Persisted Queries (APQ) support. -//! -//! APQ flow: -//! -//! 1. Client sends `{extensions: {persistedQuery: {sha256Hash, version: 1}}}` -//! without a `query` field. -//! 2. Server looks up the hash in a [`PersistedQueryStore`](crate::graphql::apq::PersistedQueryStore). -//! - **Hit:** populate the request `query` from the cache and execute. -//! - **Miss:** respond with `PERSISTED_QUERY_NOT_FOUND`. Client retries -//! with the full `query`. -//! 3. Server caches the `(hash, query)` pair on first full submission. -//! -//! This module exposes the [`PersistedQueryStore`](crate::graphql::apq::PersistedQueryStore) trait, an in-memory -//! implementation, and the [`process`](crate::graphql::apq::process) helper that walks an `async_graphql` -//! request through the lookup-or-store flow. It is a thin wrapper — the -//! actual `GraphQL` execution still goes through the `async-graphql` schema. +//! Apollo Persisted Queries: a client may send only a query's `sha256Hash` and, on +//! `PERSISTED_QUERY_NOT_FOUND`, retry with the full query, which is then cached. use std::sync::Arc; @@ -22,34 +8,16 @@ use scc::HashMap as SccHashMap; use sha2::Digest; use sha2::Sha256; -/// Store backing the persisted-query cache. +/// Cache of persisted queries keyed by their hash. #[async_trait] pub trait PersistedQueryStore: Send + Sync + 'static { - /// Retrieve a cached query by its SHA-256 hex hash. + /// Looks up a query by its lowercase hex SHA-256. async fn get(&self, hash: &str) -> Option; - /// Cache a `(hash, query)` pair. async fn put(&self, hash: String, query: String); } -/// Default in-memory store backed by `scc::HashMap` with a hard-capped entry -/// count. The previous implementation was unbounded, which let any client -/// flood the cache with `(unique-hash, full-query)` pairs and OOM the -/// process. Use [`Self::with_max_entries`] to size the cap; the default is -/// 1024 entries. -/// -/// When the cap is reached, the store performs a bulk flush rather than LRU -/// eviction (the underlying `scc::HashMap` does not expose ordering hooks). -/// Callers that need finer-grained eviction should wrap their own store -/// implementing [`PersistedQueryStore`]. -/// -/// **Soft cap, not hard:** the `len() >= cap → clear() → insert()` sequence -/// in [`PersistedQueryStore::put`] is not atomic. Concurrent puts each -/// observe `len < cap`, all proceed past the check, and each insert lands — -/// the effective ceiling is `cap + concurrent_put_count`. The race is -/// memory-safe (scc takes care of the per-entry locking) and only ever -/// over-shoots by the number of in-flight `put`s, which is bounded by your -/// request concurrency. If you need a hard cap, layer in your own -/// `PersistedQueryStore` impl with `Mutex` semantics. +/// In-memory store that drops every entry once full; concurrent `put`s can overshoot the +/// cap by their number. #[derive(Clone)] pub struct MemoryPersistedQueryStore { inner: Arc>, @@ -63,13 +31,12 @@ impl Default for MemoryPersistedQueryStore { } impl MemoryPersistedQueryStore { - /// Create a store with the default 1024-entry cap. + /// Creates a store capped at 1024 entries. pub fn new() -> Self { Self::with_max_entries(1024) } - /// Create a store that admits at most `max_entries` cached `(hash, query)` - /// pairs before the next insert triggers a full flush. + /// A `max_entries` of 0 is treated as 1. pub fn with_max_entries(max_entries: usize) -> Self { Self { inner: Arc::new(SccHashMap::new()), @@ -92,20 +59,19 @@ impl PersistedQueryStore for MemoryPersistedQueryStore { } } -/// Errors emitted by the APQ pipeline. +/// Errors emitted by [`process`]. #[derive(Debug, Clone)] pub enum ApqError { - /// Client referenced a hash the store does not know — instruct the client - /// to retry with the full query. + /// The hash is not cached; the client should retry with the full query. PersistedQueryNotFound, - /// Client supplied both a query and a hash but they don't match. + /// The request carries both a query and a hash, and they do not match. HashMismatch, /// `extensions.persistedQuery.version` was not `1`. UnsupportedVersion, } impl ApqError { - /// `PERSISTED_QUERY_NOT_FOUND` is the canonical Apollo extensions code. + /// The Apollo `extensions.code` to report, e.g. `PERSISTED_QUERY_NOT_FOUND`. pub fn extensions_code(&self) -> &'static str { match self { ApqError::PersistedQueryNotFound => "PERSISTED_QUERY_NOT_FOUND", @@ -115,28 +81,19 @@ impl ApqError { } } -/// Compute the lowercase hex SHA-256 of a query string. +/// Lowercase hex SHA-256 of `query`. pub fn sha256_hash(query: &str) -> String { use std::fmt::Write as _; let digest = Sha256::digest(query.as_bytes()); let mut hex = String::with_capacity(64); - // `write!` formats directly into the existing buffer; the old - // `format!("{b:02x}")` allocated a fresh 2-byte String per nibble - // pair (32 throwaway allocations per hash) on the APQ hot path. for b in digest { let _ = write!(&mut hex, "{b:02x}"); } hex } -/// Process an `async_graphql::Request` against the persisted-query store. -/// -/// - When the request carries `extensions.persistedQuery.sha256Hash`: -/// - if `query` is empty: look up the hash in the store; on miss return -/// `PersistedQueryNotFound`. -/// - if `query` is present: verify the hash matches; on success cache it. -/// - When no persisted-query extension is present: pass-through. -#[cfg(feature = "async-graphql")] +/// Fills an empty `query` from `store` by its `persistedQuery` hash, or checks and caches a +/// full one; requests without the extension pass through unchanged. pub async fn process( mut req: async_graphql::Request, store: &dyn PersistedQueryStore, diff --git a/tako-rs-core/src/graphql/limits.rs b/tako-rs-core/src/graphql/limits.rs index ab0e57cc..92d93d28 100644 --- a/tako-rs-core/src/graphql/limits.rs +++ b/tako-rs-core/src/graphql/limits.rs @@ -1,8 +1,4 @@ -//! `GraphQL` execution-cost limits. -//! -//! Thin re-export layer over `async_graphql::extensions::Logger` / -//! `MaxDepth` / `MaxComplexity`-style controls, exposing one `Limits` builder -//! that callers attach to their schema before serving requests. +//! Query depth and complexity caps applied to an `async_graphql` schema builder. //! //! ```rust,ignore //! use async_graphql::Schema; @@ -18,10 +14,9 @@ //! let schema = limits.apply(Schema::build(Q, M, S)).finish(); //! ``` -#[cfg(feature = "async-graphql")] use async_graphql::SchemaBuilder; -/// Builder for execution-cost limits. +/// Execution-cost caps for a schema; `None` leaves a cap off. #[derive(Debug, Clone, Copy, Default)] pub struct Limits { pub max_depth: Option, @@ -29,25 +24,22 @@ pub struct Limits { } impl Limits { - /// Empty limits (no caps). pub fn new() -> Self { Self::default() } - /// Cap query depth — depth is the longest selection-set chain. + /// Caps query depth, the longest chain of nested selection sets. pub fn max_depth(mut self, n: usize) -> Self { self.max_depth = Some(n); self } - /// Cap query complexity — sum of `@cost`-annotated field weights. + /// Caps query complexity, the sum of field complexities (1 each unless overridden). pub fn max_complexity(mut self, n: usize) -> Self { self.max_complexity = Some(n); self } - /// Apply both limits to an `async_graphql::SchemaBuilder`. - #[cfg(feature = "async-graphql")] pub fn apply(self, mut b: SchemaBuilder) -> SchemaBuilder { if let Some(d) = self.max_depth { b = b.limit_depth(d); diff --git a/tako-rs-core/src/graphql/protocol.rs b/tako-rs-core/src/graphql/protocol.rs index 36fa4f6b..d6e2569a 100644 --- a/tako-rs-core/src/graphql/protocol.rs +++ b/tako-rs-core/src/graphql/protocol.rs @@ -1,9 +1,7 @@ -//! WebSocket subprotocol negotiation for `GraphQL` subscriptions: -//! the [`GraphQLProtocol`] extractor and its rejection type. - use std::str::FromStr; use async_graphql::http::WebSocketProtocols; +use http::HeaderMap; use http::StatusCode; use http::header; @@ -13,7 +11,7 @@ use crate::responder::Responder; use crate::types::Request; use crate::types::Response; -/// Extracted WebSocket protocol for `GraphQL` subscriptions. +/// The first `GraphQL` subprotocol the client offers in `Sec-WebSocket-Protocol`. pub struct GraphQLProtocol(pub WebSocketProtocols); #[derive(Debug)] @@ -29,25 +27,26 @@ impl Responder for GraphQLProtocolRejection { } } +pub(super) fn negotiate(headers: &HeaderMap) -> Result { + headers + .get(header::SEC_WEBSOCKET_PROTOCOL) + .and_then(|v| v.to_str().ok()) + .and_then(|protocols| { + protocols + .split(',') + .find_map(|p| WebSocketProtocols::from_str(p.trim()).ok()) + }) + .map(GraphQLProtocol) + .ok_or(GraphQLProtocolRejection) +} + impl<'a> FromRequestParts<'a> for GraphQLProtocol { type Error = GraphQLProtocolRejection; fn from_request_parts( parts: &'a mut http::request::Parts, ) -> impl core::future::Future> + Send + 'a { - futures_util::future::ready( - parts - .headers - .get(header::SEC_WEBSOCKET_PROTOCOL) - .and_then(|v| v.to_str().ok()) - .and_then(|protocols| { - protocols - .split(',') - .find_map(|p| WebSocketProtocols::from_str(p.trim()).ok()) - }) - .map(GraphQLProtocol) - .ok_or(GraphQLProtocolRejection), - ) + futures_util::future::ready(negotiate(&parts.headers)) } } @@ -57,18 +56,6 @@ impl<'a> FromRequest<'a> for GraphQLProtocol { fn from_request( req: &'a mut Request, ) -> impl core::future::Future> + Send + 'a { - futures_util::future::ready( - req - .headers() - .get(header::SEC_WEBSOCKET_PROTOCOL) - .and_then(|v| v.to_str().ok()) - .and_then(|protocols| { - protocols - .split(',') - .find_map(|p| WebSocketProtocols::from_str(p.trim()).ok()) - }) - .map(GraphQLProtocol) - .ok_or(GraphQLProtocolRejection), - ) + futures_util::future::ready(negotiate(req.headers())) } } diff --git a/tako-rs-core/src/graphql/request.rs b/tako-rs-core/src/graphql/request.rs index a9f5814a..fff845f6 100644 --- a/tako-rs-core/src/graphql/request.rs +++ b/tako-rs-core/src/graphql/request.rs @@ -1,5 +1,4 @@ -//! `GraphQL` HTTP request extraction: single and batch extractors, body-size -//! limits, content-type classification, and the `receive_*` helpers. +use std::sync::Arc; use async_graphql::BatchRequest as GqlBatchRequest; use async_graphql::http::MultipartOptions; @@ -8,10 +7,11 @@ use http_body_util::BodyExt; use crate::extractors::FromRequest; use crate::responder::Responder; +use crate::router_state::RouterState; use crate::types::Request; use crate::types::Response; -/// Single `GraphQL` request extractor. +/// Extracts one `GraphQL` request from a GET query string or a POST body. pub struct GraphQLRequest(pub async_graphql::Request); impl GraphQLRequest { @@ -20,7 +20,7 @@ impl GraphQLRequest { } } -/// Batch `GraphQL` request extractor. +/// Extracts a batch of `GraphQL` requests; a GET query string yields a batch of one. pub struct GraphQLBatchRequest(pub GqlBatchRequest); impl GraphQLBatchRequest { @@ -29,29 +29,21 @@ impl GraphQLBatchRequest { } } -/// Cap on the raw POST body GraphQL extractors will buffer. -/// -/// Async-graphql parses the entire request body into memory before it can -/// validate the query, so without an upstream limit a single unauthenticated -/// POST could buffer many GB and OOM the process. `4 MiB` matches the default -/// body limits of comparable frameworks (Apollo, Hasura, federation gateways) -/// and is large enough for any realistic GraphQL document plus variables. +/// Largest POST body the `GraphQL` extractors buffer; async-graphql parses the whole body +/// before it can validate the query. pub const MAX_GRAPHQL_BODY_SIZE: usize = 4 * 1024 * 1024; -/// Errors that can occur while parsing `GraphQL` HTTP requests. +/// Rejection of a `GraphQL` HTTP request, answered with a 400, 413 or 415. #[derive(Debug)] pub enum GraphQLError { - MissingQuery, BodyRead(String), - /// Request body exceeds [`MAX_GRAPHQL_BODY_SIZE`] — either by - /// advertised `Content-Length` or by actual streamed bytes. + /// The body, declared or streamed, exceeds [`MAX_GRAPHQL_BODY_SIZE`]. BodyTooLarge, - InvalidJson(String), Parse(String), UnsupportedMediaType(String), } -/// Per-request or global options for `GraphQL` extraction. +/// Per-request options for the `GraphQL` extractors, set with [`attach_graphql_options`]. #[derive(Clone, Default)] pub struct GraphQLOptions { pub multipart: MultipartOptions, @@ -60,9 +52,6 @@ pub struct GraphQLOptions { impl Responder for GraphQLError { fn into_response(self) -> Response { match self { - GraphQLError::MissingQuery => { - (StatusCode::BAD_REQUEST, "Missing GraphQL query").into_response() - } GraphQLError::BodyRead(e) => { (StatusCode::BAD_REQUEST, format!("Failed to read body: {e}")).into_response() } @@ -71,9 +60,6 @@ impl Responder for GraphQLError { format!("GraphQL body exceeds {MAX_GRAPHQL_BODY_SIZE} bytes"), ) .into_response(), - GraphQLError::InvalidJson(e) => { - (StatusCode::BAD_REQUEST, format!("Invalid JSON: {e}")).into_response() - } GraphQLError::Parse(e) => { (StatusCode::BAD_REQUEST, format!("Invalid request: {e}")).into_response() } @@ -86,11 +72,8 @@ impl Responder for GraphQLError { } } -/// Returns the `GraphQL` POST body media-type bucket if the request's -/// `Content-Type` header advertises one async-graphql understands, or -/// `Err(UnsupportedMediaType)` otherwise. Used to fail fast before buffering -/// a body that the parser would reject anyway with a confusing message. -fn classify_graphql_content_type(ct: Option<&str>) -> Result { +/// Rejects a content type async-graphql cannot parse before the body is buffered. +fn check_content_type(ct: Option<&str>) -> Result<(), GraphQLError> { let raw = ct.unwrap_or("").trim(); if raw.is_empty() { return Err(GraphQLError::UnsupportedMediaType("".to_string())); @@ -102,31 +85,26 @@ fn classify_graphql_content_type(ct: Option<&str>) -> Result Ok(GraphQLBodyKind::Json), - "application/graphql" | "application/graphql-response+json" => Ok(GraphQLBodyKind::Graphql), - "multipart/form-data" => Ok(GraphQLBodyKind::Multipart), + "application/json" + | "application/graphql" + | "application/graphql-response+json" + | "multipart/form-data" => Ok(()), _ => Err(GraphQLError::UnsupportedMediaType(raw.to_string())), } } -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -enum GraphQLBodyKind { - Json, - Graphql, - Multipart, -} - -#[inline] +/// The request's options, then the router's state, then the process-global store. fn resolve_opts(req: &Request) -> MultipartOptions { - // Prefer per-request options in extensions - if let Some(opts) = req.extensions().get::() { + let extensions = req.extensions(); + if let Some(opts) = extensions.get::() { return opts.multipart; } - // Fallback to global state - if let Some(global) = crate::state::get_state::() { - return global.as_ref().multipart; - } - MultipartOptions::default() + extensions + .get::>() + .and_then(|state| state.get::()) + .or_else(crate::state::get_state::) + .map(|opts| opts.multipart) + .unwrap_or_default() } fn parse_get_request(req: &Request) -> Result { @@ -135,9 +113,6 @@ fn parse_get_request(req: &Request) -> Result Result { - // Pre-check the advertised length: if the client says >MAX up front, - // refuse without touching the body at all. Defends against allocation - // pressure from header-only flooders. if let Some(cl) = req.headers().get(http::header::CONTENT_LENGTH) && let Some(n) = cl.to_str().ok().and_then(|s| s.parse::().ok()) && n > MAX_GRAPHQL_BODY_SIZE @@ -145,17 +120,12 @@ async fn read_body_bytes(req: &mut Request) -> Result Ok(c.to_bytes()), Err(e) => { - // `Limited` surfaces `LengthLimitError` on cap overrun; otherwise - // it's a transport / body error. Use the type-name to disambiguate - // without depending on the private error path. if e .downcast_ref::() .is_some() @@ -175,67 +145,29 @@ impl<'a> FromRequest<'a> for GraphQLRequest { req: &'a mut Request, ) -> impl core::future::Future> + Send + 'a { async move { - if req.method() == http::Method::GET { - return Ok(GraphQLRequest(parse_get_request(req)?)); - } - - // Resolve MultipartOptions: request extensions -> global state -> default let opts = resolve_opts(req); - - let content_type = req - .headers() - .get(http::header::CONTENT_TYPE) - .and_then(|v| v.to_str().ok()) - .map(std::string::ToString::to_string); - classify_graphql_content_type(content_type.as_deref())?; - - let body = read_body_bytes(req).await?; - if body.is_empty() { - return Err(GraphQLError::Parse("empty request body".to_string())); - } - - let reader = futures_util::io::Cursor::new(body.to_vec()); - let req = async_graphql::http::receive_body(content_type.as_deref(), reader, opts) - .await - .map_err(|e| GraphQLError::Parse(e.to_string()))?; - Ok(GraphQLRequest(req)) + receive_graphql(req, opts).await.map(GraphQLRequest) } } } -/// Helper to receive a single `GraphQL` request with custom `MultipartOptions`. -/// Attach per-request `GraphQL` options into request extensions. +/// Sets the options the `GraphQL` extractors use for this request, e.g. from a middleware. pub fn attach_graphql_options(req: &mut Request, opts: GraphQLOptions) { req.extensions_mut().insert(opts); } -/// Set global `GraphQL` options via Tako's global state. -#[deprecated(note = "use attach_graphql_options on each request")] -#[allow(deprecated)] -pub fn set_global_graphql_options(opts: GraphQLOptions) { - crate::state::set_state::(opts); -} - +/// Reads one `GraphQL` request from a GET query string or a POST body with `opts`. pub async fn receive_graphql( req: &mut Request, opts: MultipartOptions, ) -> Result { - if req.method() == http::Method::GET { - return parse_get_request(req); - } - let body = read_body_bytes(req).await?; - let content_type = req - .headers() - .get(http::header::CONTENT_TYPE) - .and_then(|v| v.to_str().ok()) - .map(std::string::ToString::to_string); - let reader = futures_util::io::Cursor::new(body.to_vec()); - async_graphql::http::receive_body(content_type.as_deref(), reader, opts) - .await + receive_graphql_batch(req, opts) + .await? + .into_single() .map_err(|e| GraphQLError::Parse(e.to_string())) } -/// Helper to receive a batch `GraphQL` request with custom `MultipartOptions`. +/// Reads a batch of `GraphQL` requests with `opts`; a GET query string yields a batch of one. pub async fn receive_graphql_batch( req: &mut Request, opts: MultipartOptions, @@ -249,12 +181,12 @@ pub async fn receive_graphql_batch( .get(http::header::CONTENT_TYPE) .and_then(|v| v.to_str().ok()) .map(std::string::ToString::to_string); - classify_graphql_content_type(content_type.as_deref())?; + check_content_type(content_type.as_deref())?; let body = read_body_bytes(req).await?; if body.is_empty() { return Err(GraphQLError::Parse("empty request body".to_string())); } - let reader = futures_util::io::Cursor::new(body.to_vec()); + let reader = futures_util::io::Cursor::new(body); async_graphql::http::receive_batch_body(content_type.as_deref(), reader, opts) .await .map_err(|e| GraphQLError::Parse(e.to_string())) @@ -267,30 +199,10 @@ impl<'a> FromRequest<'a> for GraphQLBatchRequest { req: &'a mut Request, ) -> impl core::future::Future> + Send + 'a { async move { - if req.method() == http::Method::GET { - // Treat GET as single request - let single = parse_get_request(req)?; - return Ok(GraphQLBatchRequest(GqlBatchRequest::Single(single))); - } - - // Resolve MultipartOptions: request extensions -> global state -> default let opts = resolve_opts(req); - - let content_type = req - .headers() - .get(http::header::CONTENT_TYPE) - .and_then(|v| v.to_str().ok()) - .map(std::string::ToString::to_string); - classify_graphql_content_type(content_type.as_deref())?; - let body = read_body_bytes(req).await?; - if body.is_empty() { - return Err(GraphQLError::Parse("empty request body".to_string())); - } - let reader = futures_util::io::Cursor::new(body.to_vec()); - let batch = async_graphql::http::receive_batch_body(content_type.as_deref(), reader, opts) + receive_graphql_batch(req, opts) .await - .map_err(|e| GraphQLError::Parse(e.to_string()))?; - Ok(GraphQLBatchRequest(batch)) + .map(GraphQLBatchRequest) } } } diff --git a/tako-rs-core/src/graphql/response.rs b/tako-rs-core/src/graphql/response.rs index 6eafdb6f..273c3ccd 100644 --- a/tako-rs-core/src/graphql/response.rs +++ b/tako-rs-core/src/graphql/response.rs @@ -1,6 +1,3 @@ -//! `GraphQL` response responders: single and batch JSON responders that -//! serialize an `async_graphql` response into an `application/json` body. - use async_graphql::BatchResponse as GqlBatchResponse; use http::HeaderValue; use http::StatusCode; @@ -10,7 +7,7 @@ use crate::body::TakoBody; use crate::responder::Responder; use crate::types::Response; -/// Single `GraphQL` response wrapper. +/// Sends an `async_graphql::Response` as an `application/json` body. pub struct GraphQLResponse(pub async_graphql::Response); impl From for GraphQLResponse { @@ -35,7 +32,7 @@ impl Responder for GraphQLResponse { } } -/// Batch `GraphQL` response wrapper. +/// Sends an `async_graphql::BatchResponse` as an `application/json` body. pub struct GraphQLBatchResponse(pub GqlBatchResponse); impl From for GraphQLBatchResponse { diff --git a/tako-rs-core/src/graphql/subscription.rs b/tako-rs-core/src/graphql/subscription.rs index f51f83f1..351ffc2c 100644 --- a/tako-rs-core/src/graphql/subscription.rs +++ b/tako-rs-core/src/graphql/subscription.rs @@ -1,8 +1,4 @@ -//! `GraphQL`-over-WebSocket subscription responder that performs the HTTP -//! upgrade handshake and drives async-graphql's WebSocket state machine. - use std::future::Future; -use std::str::FromStr; use std::time::Duration; use async_graphql::Data; @@ -10,7 +6,6 @@ use async_graphql::Executor; use async_graphql::Result as GqlResult; use async_graphql::http::DefaultOnConnInitType; use async_graphql::http::DefaultOnPingType; -use async_graphql::http::WebSocketProtocols; use async_graphql::http::default_on_connection_init; use async_graphql::http::default_on_ping; use http::HeaderValue; @@ -25,9 +20,9 @@ use crate::types::Request; use crate::types::Response; use crate::ws; -/// `GraphQL` WebSocket subscription responder (`GraphQL` over WebSocket). +/// Upgrades the request and serves `GraphQL` subscriptions over the negotiated subprotocol. /// -/// Usage in a handler: +/// # Examples /// /// ```ignore /// let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot).finish(); @@ -36,7 +31,6 @@ use crate::ws; /// async move { GraphQLSubscription::new(req, schema) } /// }); /// ``` -#[cfg(not(feature = "compio"))] pub struct GraphQLSubscription where E: Executor, @@ -49,7 +43,6 @@ where keepalive_timeout: Option, } -#[cfg(not(feature = "compio"))] impl GraphQLSubscription where E: Executor, @@ -66,7 +59,6 @@ where } } -#[cfg(not(feature = "compio"))] impl GraphQLSubscription where E: Executor, @@ -112,7 +104,6 @@ where } } -#[cfg(not(feature = "compio"))] impl Responder for GraphQLSubscription where @@ -127,22 +118,9 @@ where Ok(accept) => accept, Err(status) => return ws::rejection(status), }; - let Some(protocol) = self - .request - .headers() - .get(header::SEC_WEBSOCKET_PROTOCOL) - .and_then(|value| value.to_str().ok()) - .and_then(|offered| { - offered - .split(',') - .find_map(|name| WebSocketProtocols::from_str(name.trim()).ok()) - }) - else { - return ( - StatusCode::BAD_REQUEST, - "Missing or invalid Sec-WebSocket-Protocol", - ) - .into_response(); + let protocol = match super::protocol::negotiate(self.request.headers()) { + Ok(super::GraphQLProtocol(protocol)) => protocol, + Err(rejection) => return rejection.into_response(), }; let response = http::Response::builder() .status(StatusCode::SWITCHING_PROTOCOLS) diff --git a/tako-rs-core/src/graphql/websocket.rs b/tako-rs-core/src/graphql/websocket.rs index 3f504ff1..5278607f 100644 --- a/tako-rs-core/src/graphql/websocket.rs +++ b/tako-rs-core/src/graphql/websocket.rs @@ -1,5 +1,3 @@ -//! Generic `GraphQL`-over-WebSocket driver over any `Sink`/`Stream` pair of WebSocket messages. - use std::future::Future; use std::time::Duration; @@ -23,7 +21,6 @@ use crate::ws::Error; use crate::ws::Message; /// Runs async-graphql's WebSocket protocol over any `Sink`/`Stream` of WebSocket messages. -#[cfg(not(feature = "compio"))] pub struct GraphQLWebSocket where E: Executor, @@ -38,7 +35,6 @@ where keepalive_timeout: Option, } -#[cfg(not(feature = "compio"))] impl GraphQLWebSocket< futures_util::stream::SplitSink, @@ -51,14 +47,13 @@ where S: Stream> + Sink, E: Executor, { - /// Create a `GraphQLWebSocket` from a combined websocket stream implementing `Sink`+`Stream`. + /// Splits a socket that is both the `Sink` and the `Stream`. pub fn new(stream: S, executor: E, protocol: WebSocketProtocols) -> Self { let (sink, stream) = stream.split(); GraphQLWebSocket::new_with_pair(sink, stream, executor, protocol) } } -#[cfg(not(feature = "compio"))] impl GraphQLWebSocket where @@ -66,7 +61,7 @@ where StreamT: Stream>, E: Executor, { - /// Create a `GraphQLWebSocket` from separate sink and stream. + /// Uses a sink and a stream that are already separate. pub fn new_with_pair( sink: SinkT, stream: StreamT, @@ -86,7 +81,6 @@ where } } -#[cfg(not(feature = "compio"))] impl GraphQLWebSocket where SinkT: Sink, @@ -105,7 +99,6 @@ where } } -#[cfg(not(feature = "compio"))] impl GraphQLWebSocket where @@ -154,7 +147,7 @@ where } } - /// Runs the `GraphQL` over WebSocket protocol until the connection ends. + /// Serves the protocol until the connection closes or a read fails. pub async fn serve(self) { let Self { sink, diff --git a/tako-rs-core/src/grpc.rs b/tako-rs-core/src/grpc.rs index 1bf828cc..7663d32a 100644 --- a/tako-rs-core/src/grpc.rs +++ b/tako-rs-core/src/grpc.rs @@ -1,14 +1,4 @@ -#![cfg_attr(docsrs, doc(cfg(feature = "grpc")))] - -//! gRPC over HTTP/2: unary, server-streaming, client-streaming, and -//! bidirectional RPCs. -//! -//! Each method is an ordinary `POST /./` route. -//! [`GrpcRequest`](crate::grpc::GrpcRequest) and -//! [`GrpcResponse`](crate::grpc::GrpcResponse) handle one message each way; -//! [`GrpcServerStream`](crate::grpc::GrpcServerStream) streams replies, -//! [`GrpcClientStream`](crate::grpc::GrpcClientStream) reads a request stream, -//! and [`GrpcBidi`](crate::grpc::GrpcBidi) does both at once. +//! gRPC over HTTP/2: each method is a `POST /./` route, and //! `Option` extracts the client's `grpc-timeout`. //! //! # Examples @@ -58,13 +48,9 @@ //! router.route(Method::POST, "/math.Math/Echo", echo); //! ``` -/// `grpc.health.v1` scaffolding. pub mod health; -/// gRPC-specific interceptor pattern. pub mod interceptor; -/// `grpc.reflection.v1` scaffolding. pub mod reflection; -/// gRPC-Web bridge translating browser-friendly framing to canonical gRPC. pub mod web; mod framing; @@ -83,7 +69,6 @@ pub use message::GrpcRequest; pub use message::GrpcResponse; pub use status::GrpcStatus; pub use status::GrpcStatusCode; -pub(crate) use status::build_grpc_error_response; pub use streaming::GrpcBidi; pub use streaming::GrpcClientStream; pub use streaming::GrpcServerStream; diff --git a/tako-rs-core/src/grpc/framing.rs b/tako-rs-core/src/grpc/framing.rs index 37cc8201..03c61b49 100644 --- a/tako-rs-core/src/grpc/framing.rs +++ b/tako-rs-core/src/grpc/framing.rs @@ -1,8 +1,3 @@ -//! gRPC length-prefix framing: the message-size cap, encode/decode of a -//! single `[compressed][length][bytes]` frame, the incremental decoder that -//! reads messages off a request body, and the `GrpcError` type those -//! operations surface. - use std::marker::PhantomData; use std::pin::Pin; use std::task::Context; @@ -20,38 +15,25 @@ use crate::body::TakoBody; use crate::responder::Responder; use crate::types::Response; -/// Cap on the `length` prefix of a single gRPC frame. Without it any client -/// can advertise a 4 GiB message and force the parser to either pre-allocate -/// that much space or treat the body as well-formed-but-truncated. 4 MiB -/// matches the default `grpc-go` and `tonic` server limits. +/// Largest message a request frame may declare, the `grpc-go` and `tonic` default. pub const MAX_GRPC_MESSAGE_SIZE: usize = 4 * 1024 * 1024; /// Length of the `[compressed: u8][length: u32 BE]` prefix. const PREFIX_LEN: usize = 5; -/// Error types for gRPC extraction. +/// Rejection of a gRPC request, answered with a trailers-only response. #[derive(Debug)] pub enum GrpcError { /// Content-Type is not application/grpc. InvalidContentType, - /// Failed to read the request body. BodyReadError(String), - /// gRPC frame is too short or malformed. + /// The body ends inside a frame, or a frame is malformed. InvalidFrame, - /// Length-prefix advertises a message larger than [`MAX_GRPC_MESSAGE_SIZE`]. - /// - /// Mapped to gRPC status `ResourceExhausted` (8) per the spec — `grpc-go`, - /// `tonic`, and the upstream issue (grpc/grpc#23454) all use it for - /// `received message larger than max`. Returning `InvalidArgument` would - /// be wire-level wrong: clients that backoff-retry on `ResourceExhausted` - /// would never retry on `InvalidArgument`. + /// A frame declares more than [`MAX_GRPC_MESSAGE_SIZE`]; sent as `ResourceExhausted`, as + /// `grpc-go` and `tonic` do, so clients may back off and retry. MessageTooLarge, - /// Protobuf decoding failed. DecodeError(String), - /// Frame's compressed flag was set but the server does not advertise - /// any compression codec. Mapped to gRPC status `Unimplemented` per - /// the spec (/) so clients fall back - /// to uncompressed. + /// A frame is compressed but no codec is configured; sent as `Unimplemented`. CompressionUnsupported, } @@ -59,12 +41,7 @@ impl GrpcError { fn status_parts(&self) -> (GrpcStatusCode, &'static str) { match self { GrpcError::InvalidContentType => ( - // Spec maps wrong/missing content-type to `Unimplemented` (12) — - // see PROTOCOL-HTTP2.md ("If Content-Type does not begin with - // 'application/grpc', gRPC servers SHOULD respond with HTTP - // status of 415 (Unsupported Media Type)"). grpcurl/Envoy - // route on this distinction; `InvalidArgument` would suggest - // a request-payload bug instead of an unsupported protocol. + // `Unimplemented`, not `InvalidArgument`: the protocol is unsupported, not the payload. GrpcStatusCode::Unimplemented, "invalid content-type; expected application/grpc", ), @@ -86,8 +63,7 @@ impl GrpcError { } } -/// Maps a request-side failure to the status a streaming handler sends, so -/// `?` works inside a reply stream that reads a [`GrpcClientStream`](super::GrpcClientStream). +/// Lets `?` turn a [`GrpcClientStream`](super::GrpcClientStream) error into a reply's status. impl From for GrpcStatus { fn from(error: GrpcError) -> Self { let (code, message) = error.status_parts(); @@ -102,18 +78,7 @@ impl Responder for GrpcError { } } -/// Encode a protobuf message with gRPC length-prefix framing. -/// -/// Format: `[compressed: u8][length: u32 BE][message bytes]` -/// -/// # Panics -/// -/// Panics if the encoded message exceeds `u32::MAX` (≈ 4 GiB). gRPC's wire -/// format uses a 4-byte big-endian length prefix, so anything larger would -/// silently wrap to a wrong length and produce undecodable frames. The assert -/// turns that silent corruption into a loud server-side crash with a clear -/// site. (Outbound messages this large already indicate a serious -/// memory-pressure problem in the calling handler.) +/// Encodes `msg` as one uncompressed length-prefixed frame; panics past `u32::MAX` bytes. pub fn grpc_encode(msg: &T) -> Vec { let len = msg.encoded_len(); let mut frame = Vec::with_capacity(PREFIX_LEN + len); @@ -124,8 +89,7 @@ pub fn grpc_encode(msg: &T) -> Vec { frame } -/// Appends one framed message to `buf`, which batches consecutive messages -/// into a single DATA frame. +/// Appends one frame to `buf`, so consecutive messages can share a DATA frame. pub(crate) fn encode_into(msg: &T, buf: &mut BytesMut) { let len = msg.encoded_len(); buf.reserve(PREFIX_LEN + len); @@ -146,16 +110,12 @@ fn frame_prefix(len: usize) -> [u8; PREFIX_LEN] { [0, a, b, c, d] } -/// Decode a gRPC length-prefix framed message. -/// -/// Returns the decoded message and whether compression was indicated. -pub fn grpc_decode(data: &[u8]) -> Result<(T, bool), GrpcError> { +/// Decodes the first frame of `data`; compressed frames are rejected. +pub fn grpc_decode(data: &[u8]) -> Result { if data.len() < PREFIX_LEN { return Err(GrpcError::InvalidFrame); } - - let compressed = data[0] != 0; - if compressed { + if data[0] != 0 { return Err(GrpcError::CompressionUnsupported); } let msg_len = u32::from_be_bytes([data[1], data[2], data[3], data[4]]) as usize; @@ -167,16 +127,12 @@ pub fn grpc_decode(data: &[u8]) -> Result<(T, bool), GrpcE return Err(GrpcError::InvalidFrame); } - let msg = T::decode(&data[PREFIX_LEN..PREFIX_LEN + msg_len]) - .map_err(|e| GrpcError::DecodeError(e.to_string()))?; - Ok((msg, compressed)) + T::decode(&data[PREFIX_LEN..PREFIX_LEN + msg_len]) + .map_err(|e| GrpcError::DecodeError(e.to_string())) } -/// Reads length-prefixed messages off a request body as they arrive. -/// -/// Buffers at most one message plus one body chunk. The first error ends the -/// stream, and a body that stops inside a frame yields -/// [`GrpcError::InvalidFrame`]. +/// Decodes frames off a body as they arrive, buffering at most one message plus one chunk; +/// the first error ends the stream. pub(crate) struct FrameDecoder { body: TakoBody, buffer: BytesMut, diff --git a/tako-rs-core/src/grpc/health.rs b/tako-rs-core/src/grpc/health.rs index 541902d3..86acb14b 100644 --- a/tako-rs-core/src/grpc/health.rs +++ b/tako-rs-core/src/grpc/health.rs @@ -1,18 +1,10 @@ -//! `grpc.health.v1.Health` scaffolding. -//! -//! Maintains a per-service health-status map. Handlers / middleware can flip -//! a service from `Serving` to `NotServing` (e.g. when a backing dependency -//! fails) and the `Check` / `Watch` RPC implementations report it. -//! -//! ⚠️ **Status:** like the reflection module, this is the building block. -//! Integrate with a generated `Health` server stub or hand-rolled handler; -//! the registry below is the long-lived state. +//! Per-service status map for a `grpc.health.v1.Health` service; serve it from your own +//! `Check` and `Watch` handlers. use std::sync::Arc; use scc::HashMap as SccHashMap; -/// Per-service health status. #[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] pub enum ServingStatus { Unknown, @@ -22,28 +14,24 @@ pub enum ServingStatus { ServiceUnknown, } -/// Health registry shared between handlers and operator hooks. +/// Service statuses; clones share one map. #[derive(Clone, Default)] pub struct HealthRegistry { inner: Arc>, } impl HealthRegistry { - /// New empty registry. pub fn new() -> Self { Self::default() } - /// Set the status for a service (empty string `""` is the overall status). + /// Sets the status of `service`; the empty name `""` is the server's overall status. pub fn set_status(&self, service: impl Into, status: ServingStatus) { - // `upsert_sync` so subsequent calls flip the recorded status (e.g. - // `Serving -> NotServing` when a backing dependency fails). - // `insert_sync` would make this a write-once-per-service registry — - // load balancers would keep routing to a dead pod. + // `insert_sync` would keep the first status ever set. self.inner.upsert_sync(service.into(), status); } - /// Read the status for a service. + /// `ServiceUnknown` for a service that was never set. pub fn status_of(&self, service: &str) -> ServingStatus { self .inner @@ -51,7 +39,6 @@ impl HealthRegistry { .map_or(ServingStatus::ServiceUnknown, |e| *e.get()) } - /// Snapshot of every registered service and its status. pub fn snapshot(&self) -> Vec<(String, ServingStatus)> { let mut out = Vec::new(); self.inner.iter_sync(|k, v| { diff --git a/tako-rs-core/src/grpc/interceptor.rs b/tako-rs-core/src/grpc/interceptor.rs index 5de110ba..c9a2babd 100644 --- a/tako-rs-core/src/grpc/interceptor.rs +++ b/tako-rs-core/src/grpc/interceptor.rs @@ -1,25 +1,5 @@ -//! gRPC-specific interceptor middleware. -//! -//! HTTP middleware (`tako_rs_core::middleware::Next`) operates on `Request` / -//! `Response`, so it can pre/post-process arbitrary HTTP traffic. gRPC adds -//! two extra concerns that don't translate cleanly: -//! -//! 1. **Status lives in trailers** — modifying `grpc-status` from a regular -//! middleware requires rewriting the response body's trailing frame. -//! 2. **Per-method interceptors** — gRPC interceptors are usually attached -//! per-service or per-method, not per-HTTP-route. -//! -//! This module exposes: -//! -//! - [`GrpcInterceptor`](crate::grpc::interceptor::GrpcInterceptor) — async trait whose `intercept` runs before the -//! handler with a typed view of metadata; can short-circuit with a -//! [`GrpcStatus`](crate::grpc::GrpcStatus) error. -//! - [`InterceptorChain`](crate::grpc::interceptor::InterceptorChain) — sequence of interceptors run in order. Wraps a -//! gRPC handler so the call surface is uniform. -//! -//! ⚠️ **Status:** wiring into `Router::route` will land alongside the -//! generated stub story. The traits below already let plugin code build -//! standalone gRPC handlers that respect interceptors. +//! gRPC interceptors: checks on request metadata that run before a handler and can end the +//! call with a [`GrpcStatus`]. use std::future::Future; use std::pin::Pin; @@ -28,10 +8,11 @@ use std::sync::Arc; use http::HeaderMap; use super::GrpcStatus; +use crate::responder::Responder; use crate::types::Request; use crate::types::Response; -/// gRPC interceptor — runs before a gRPC handler. +/// Runs before a gRPC handler, see [`run_chain`]. pub trait GrpcInterceptor: Send + Sync + 'static { /// Inspect or modify metadata; return `Err(GrpcStatus)` to short-circuit. fn intercept( @@ -48,19 +29,16 @@ pub struct InterceptorChain { } impl InterceptorChain { - /// Empty chain. pub fn new() -> Self { Self::default() } - /// Append an interceptor. pub fn push(mut self, interceptor: I) -> Self { self.inner.push(Arc::new(interceptor)); self } - /// Run all interceptors against `metadata` for `method`. Returns the first - /// failure or `Ok(())` if every interceptor succeeded. + /// Runs the interceptors in order, stopping at the first failure. pub async fn run(&self, metadata: &mut HeaderMap, method: &str) -> Result<(), GrpcStatus> { for ic in &self.inner { ic.intercept(metadata, method).await?; @@ -69,10 +47,7 @@ impl InterceptorChain { } } -/// Helper that bundles a chain with a request-derived gRPC method name. -/// -/// Plugin code building a gRPC service can call this from the entry point of -/// each method handler to apply the chain uniformly. +/// Runs `chain` on the request headers; a failure comes back as a trailers-only response. #[allow( clippy::result_large_err, reason = "Boxing the response would break the public interceptor API" @@ -82,12 +57,8 @@ pub async fn run_chain( req: &mut Request, method: &str, ) -> Result<(), Response> { - let metadata = req.headers_mut(); - match chain.run(metadata, method).await { - Ok(()) => Ok(()), - Err(status) => Err(super::build_grpc_error_response( - status.code, - status.message.as_deref().unwrap_or(""), - )), - } + chain + .run(req.headers_mut(), method) + .await + .map_err(GrpcStatus::into_response) } diff --git a/tako-rs-core/src/grpc/message.rs b/tako-rs-core/src/grpc/message.rs index a9d04727..c4608980 100644 --- a/tako-rs-core/src/grpc/message.rs +++ b/tako-rs-core/src/grpc/message.rs @@ -1,6 +1,3 @@ -//! Unary gRPC request extractor (`GrpcRequest`) and response responder -//! (`GrpcResponse`) over a single length-prefixed protobuf frame. - use std::convert::Infallible; use bytes::Bytes; @@ -20,12 +17,8 @@ use crate::responder::Responder; use crate::types::Request; use crate::types::Response; -/// gRPC request extractor. -/// -/// Extracts and decodes a gRPC-framed protobuf message from the request body. -/// Validates that the content-type is `application/grpc`. +/// Unary request: the first message of an `application/grpc` body. pub struct GrpcRequest { - /// The decoded protobuf message. pub message: T, } @@ -62,20 +55,14 @@ pub(crate) fn is_grpc_content_type(req: &Request) -> bool { .is_some_and(|ct| ct.starts_with("application/grpc")) } -/// gRPC response wrapper. -/// -/// Encodes a protobuf message with gRPC framing and sets appropriate headers. +/// Unary reply: one message with `grpc-status` in trailers, or a trailers-only error. pub struct GrpcResponse { - /// The response message (None for error-only responses). message: Option, - /// gRPC status code. status: GrpcStatusCode, - /// Optional error message. error_message: Option, } impl GrpcResponse { - /// Creates a successful gRPC response with the given message. pub fn ok(message: T) -> Self { Self { message: Some(message), @@ -84,7 +71,6 @@ impl GrpcResponse { } } - /// Creates an error gRPC response with the given status and message. pub fn error(status: GrpcStatusCode, message: impl Into) -> Self { Self { message: None, diff --git a/tako-rs-core/src/grpc/reflection.rs b/tako-rs-core/src/grpc/reflection.rs index 1a2175aa..194a5a01 100644 --- a/tako-rs-core/src/grpc/reflection.rs +++ b/tako-rs-core/src/grpc/reflection.rs @@ -1,23 +1,12 @@ -//! `grpc.reflection.v1.ServerReflection` scaffolding. -//! -//! Provides a [`ReflectionRegistry`](crate::grpc::reflection::ReflectionRegistry) that callers populate with the -//! `FileDescriptorProto` blobs they want to expose; the registry answers -//! `list_services`, `file_by_filename`, and `file_containing_symbol` queries. -//! -//! ⚠️ **Status:** the encoder/decoder for `ServerReflectionRequest` / -//! `ServerReflectionResponse` is intentionally minimal — it covers the three -//! query kinds above and leaves the others (`file_containing_extension`, -//! `all_extension_numbers_of_type`) to follow-up work. Generated proto code -//! requires a build script, which would force every consumer to run -//! `protoc`; the scaffold here lets you ship reflection from a hand-rolled -//! descriptor or a pre-baked `.pb` blob in the meantime. +//! Descriptor registry for `grpc.reflection.v1`: answers `list_services`, `file_by_filename` +//! and `file_containing_symbol`, while the RPC itself is up to you. use std::sync::Arc; use parking_lot::RwLock; use scc::HashMap as SccHashMap; -/// Reflection registry — populated at startup and consulted by the reflection RPC. +/// Services and file descriptors to expose; clones share one registry. #[derive(Clone, Default)] pub struct ReflectionRegistry { services: Arc>>, @@ -26,47 +15,34 @@ pub struct ReflectionRegistry { } impl ReflectionRegistry { - /// Empty registry. pub fn new() -> Self { Self::default() } - /// Register a fully-qualified service name (e.g. `helloworld.Greeter`). + /// Registers a fully-qualified service name such as `helloworld.Greeter`. pub fn add_service(&self, name: impl Into) { self.services.write().push(name.into()); } - /// Register a file descriptor under its source filename. - /// - /// Re-registering the same filename replaces the prior descriptor (e.g. a - /// binary-rebuild that rewrites a `.pb` blob in place). + /// Registers a serialized `FileDescriptorProto`, replacing one under the same filename. pub fn add_file(&self, filename: impl Into, descriptor: Vec) { - // `upsert_sync` so re-registration of an already-known filename - // actually swaps the descriptor — `insert_sync` would silently keep - // the stale blob. self.files.upsert_sync(filename.into(), descriptor); } - /// Map a fully-qualified symbol (`pkg.Service.Method`) to the file that defines it. - /// - /// Re-mapping an existing symbol replaces the prior filename (e.g. after a - /// method moves between files). + /// Maps a symbol such as `pkg.Service.Method` to its file, replacing an earlier mapping. pub fn map_symbol(&self, symbol: impl Into, filename: impl Into) { - // See `add_file`: `upsert_sync` so re-mappings take effect. self.symbols.upsert_sync(symbol.into(), filename.into()); } - /// Snapshot of registered service names. pub fn list_services(&self) -> Vec { self.services.read().clone() } - /// Look up the descriptor blob for a filename. pub fn file_by_filename(&self, filename: &str) -> Option> { self.files.get_sync(filename).map(|e| e.get().clone()) } - /// Resolve a file descriptor by symbol (if registered via `map_symbol`). + /// Resolves the file a symbol was mapped to with [`map_symbol`](Self::map_symbol). pub fn file_containing_symbol(&self, symbol: &str) -> Option> { let entry = self.symbols.get_sync(symbol)?; let filename = entry.get().clone(); @@ -75,8 +51,7 @@ impl ReflectionRegistry { } } -/// Marker placed in router state so plugin/middleware code can discover the -/// active reflection registry. +/// Router-state wrapper that lets plugin or middleware code find the active registry. pub struct ReflectionState { pub registry: ReflectionRegistry, } diff --git a/tako-rs-core/src/grpc/status.rs b/tako-rs-core/src/grpc/status.rs index aca81560..5a25d3eb 100644 --- a/tako-rs-core/src/grpc/status.rs +++ b/tako-rs-core/src/grpc/status.rs @@ -1,16 +1,10 @@ -//! gRPC status codes, the trailer `GrpcStatus` payload, and error-response -//! construction shared across the unary and streaming responders. - use http::HeaderMap; -use http::StatusCode; use crate::body::TakoBody; use crate::responder::Responder; use crate::types::Response; -/// gRPC status codes. -/// -/// See +/// gRPC status codes, see . #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u8)] pub enum GrpcStatusCode { @@ -43,14 +37,8 @@ impl GrpcStatusCode { } } -/// Percent-encode a gRPC `Status-Message` per PROTOCOL-HTTP2.md. -/// -/// The spec preserves visible ASCII (`0x20..=0x7E`) except `%`, and -/// percent-encodes every other byte as `%XX` (upper-case hex). Without -/// this any non-ASCII character (emoji, accents, Latin-1 upstream error -/// strings) makes `HeaderValue::from_str` fail and the surrounding -/// `if let Ok(...)` silently drops the entire `grpc-message` — the -/// caller would see only `grpc-status` with no human-readable detail. +/// Percent-encodes `%` and every byte outside visible ASCII, as PROTOCOL-HTTP2 requires; a +/// raw non-ASCII byte would fail `HeaderValue` and drop the whole `grpc-message`. fn percent_encode_grpc_message(s: &str) -> String { let mut out = String::with_capacity(s.len()); for &b in s.as_bytes() { @@ -76,7 +64,6 @@ fn hex_upper(n: u8) -> char { pub(crate) fn build_grpc_error_response(status: GrpcStatusCode, message: &str) -> Response { let mut resp = Response::new(TakoBody::empty()); - *resp.status_mut() = StatusCode::OK; // gRPC always uses 200 OK at HTTP level resp.headers_mut().insert( http::header::CONTENT_TYPE, http::HeaderValue::from_static("application/grpc"), @@ -92,7 +79,7 @@ pub(crate) fn build_grpc_error_response(status: GrpcStatusCode, message: &str) - resp } -/// gRPC status payload (status code + optional message) used in trailers. +/// A `grpc-status` code and optional `grpc-message`, sent as trailers. #[derive(Debug, Clone)] pub struct GrpcStatus { pub code: GrpcStatusCode, @@ -130,8 +117,7 @@ impl GrpcStatus { } } -/// Ends the call before any message with a trailers-only response, e.g. when -/// a handler returns `Result, GrpcStatus>`. +/// Ends the call before any message, e.g. from `Result, GrpcStatus>`. impl Responder for GrpcStatus { fn into_response(self) -> Response { build_grpc_error_response(self.code, self.message.as_deref().unwrap_or("")) diff --git a/tako-rs-core/src/grpc/streaming.rs b/tako-rs-core/src/grpc/streaming.rs index 540caacb..818e1c9b 100644 --- a/tako-rs-core/src/grpc/streaming.rs +++ b/tako-rs-core/src/grpc/streaming.rs @@ -1,6 +1,3 @@ -//! Streaming gRPC: the server-streaming responder, the client-streaming -//! extractor, and the bidirectional extractor that pairs the two. -//! //! A reply starts as soon as the handler returns, while the request body is //! still open, so a bidirectional handler reads and writes concurrently. @@ -31,23 +28,16 @@ use crate::responder::Responder; use crate::types::Request; use crate::types::Response; -/// Server-streaming gRPC response. -/// -/// Sends each `Ok` item as a length-prefixed message; items that are ready -/// together share one DATA frame. The call ends with -/// `grpc-status: 0` when the stream finishes, with the status of the first -/// `Err` item (later items are dropped), or with `DeadlineExceeded` once the -/// optional deadline passes. A client that cancels drops the stream. +/// Server-streaming reply. The call ends with `grpc-status: 0`, the first `Err` item's +/// status (later items are dropped), or `DeadlineExceeded` once the deadline passes. pub struct GrpcServerStream where S: Stream> + Send + 'static, T: Message + Send + 'static, { - /// Messages to send; the first `Err` ends the call with its status. pub stream: S, - /// Server metadata sent as response headers (initial metadata). + /// Sent as response headers. pub initial_metadata: HeaderMap, - /// Ends the call with `DeadlineExceeded` once reached. pub deadline: Option, } @@ -69,8 +59,8 @@ where self } - /// Ends the call with `DeadlineExceeded` at `deadline`, typically the - /// client's `grpc-timeout` taken as an `Option` extractor. + /// Ends the call with `DeadlineExceeded` at `deadline`, typically the client's + /// `grpc-timeout` taken as an `Option` extractor. pub fn with_deadline(mut self, deadline: impl Into>) -> Self { self.deadline = deadline.into(); self @@ -95,13 +85,11 @@ where } } -/// Messages that are ready together share one DATA frame up to this size, as -/// in tonic. A frame per tiny message wastes framing overhead, and `h2` -/// clients close the connection when too many small frames wait unread. +/// Ready messages share one DATA frame up to this size, as in tonic: `h2` clients close the +/// connection when too many small frames wait unread. pub(super) const BATCH_LIMIT: usize = 32 * 1024; -/// Response body of a [`GrpcServerStream`]: DATA frames carrying the -/// messages, then exactly one trailers frame carrying `grpc-status`. +/// DATA frames carrying the messages, then exactly one trailers frame with `grpc-status`. struct GrpcStreamBody { /// `None` once the call has ended. stream: Option>>, @@ -171,12 +159,8 @@ where } } -/// Client-streaming gRPC extractor. -/// -/// Yields the request's messages as they arrive. The stream ends after the -/// first error; a request that stops inside a message yields -/// [`GrpcError::InvalidFrame`]. Each message is capped at -/// [`MAX_GRPC_MESSAGE_SIZE`](super::MAX_GRPC_MESSAGE_SIZE). +/// Client-streaming request: yields messages as they arrive, each at most +/// [`MAX_GRPC_MESSAGE_SIZE`](super::MAX_GRPC_MESSAGE_SIZE), and ends after the first error. pub struct GrpcClientStream { pub stream: Pin> + Send>>, } @@ -205,18 +189,15 @@ impl Stream for GrpcClientStream { } } -/// Bidirectional gRPC extractor. -/// -/// Reads `Req` messages like a [`GrpcClientStream`] and names the `Resp` -/// type of the reply, so [`respond`](Self::respond) can build the -/// [`GrpcServerStream`] with full type inference. +/// Bidirectional call: reads `Req` like a [`GrpcClientStream`] and fixes the `Resp` type, +/// so [`respond`](Self::respond) infers the reply stream. pub struct GrpcBidi where Req: Message + Default + Send + 'static, Resp: Message + Send + 'static, { pub inbound: GrpcClientStream, - pub _phantom: PhantomData, + _phantom: PhantomData, } impl GrpcBidi diff --git a/tako-rs-core/src/grpc/tests.rs b/tako-rs-core/src/grpc/tests.rs index 2aa4e17d..1c95b313 100644 --- a/tako-rs-core/src/grpc/tests.rs +++ b/tako-rs-core/src/grpc/tests.rs @@ -39,7 +39,7 @@ fn messages(frame: &Frame) -> Vec { let mut values = Vec::new(); while !data.is_empty() { let end = 5 + u32::from_be_bytes([data[1], data[2], data[3], data[4]]) as usize; - values.push(grpc_decode::(&data[..end]).unwrap().0.value); + values.push(grpc_decode::(&data[..end]).unwrap().value); data = &data[end..]; } values diff --git a/tako-rs-core/src/grpc/timeout.rs b/tako-rs-core/src/grpc/timeout.rs index a59466df..d5f7d960 100644 --- a/tako-rs-core/src/grpc/timeout.rs +++ b/tako-rs-core/src/grpc/timeout.rs @@ -1,7 +1,3 @@ -//! `grpc-timeout` deadline propagation: parsing the header's unit-suffixed -//! duration, stashing the resulting [`GrpcDeadline`] in request extensions, -//! extracting it in handlers, and the timer that ends a streaming reply. - use std::convert::Infallible; use std::future::Future; use std::pin::Pin; @@ -18,11 +14,8 @@ use crate::extractors::FromRequest; use crate::extractors::FromRequestParts; use crate::types::Request; -/// gRPC deadline propagated from the `grpc-timeout` request header. -/// -/// Extract it as `Option` in a handler, then pass it to -/// [`GrpcServerStream::with_deadline`](super::GrpcServerStream::with_deadline) -/// or bound unary work with [`remaining`](Self::remaining). +/// The client's `grpc-timeout` as an instant; extract it as `Option` and pass it +/// to [`GrpcServerStream::with_deadline`](super::GrpcServerStream::with_deadline). #[derive(Debug, Clone, Copy)] pub struct GrpcDeadline(pub Instant); @@ -33,9 +26,8 @@ impl GrpcDeadline { } } -/// Parse the `grpc-timeout` header value (e.g. `"100m"`, `"5S"`, `"1H"`). -/// -/// Accepts one to eight ASCII digits followed by a supported unit. +/// Parses a `grpc-timeout` value: one to eight digits and a unit `n`, `u`, `m`, `S`, `M` or +/// `H`, e.g. `"100m"`. pub fn parse_grpc_timeout(value: &str) -> Option { let value = value.trim(); if !(2..=9).contains(&value.len()) || !value.is_ascii() { @@ -58,15 +50,8 @@ pub fn parse_grpc_timeout(value: &str) -> Option { Some(dur) } -/// Extract the deadline (if any) from a request's `grpc-timeout` header. -/// -/// Inserts a [`GrpcDeadline`] into request extensions when present so handlers -/// and middleware can honor the cancellation contract. -/// -/// Uses `Instant::checked_add` so an attacker-supplied near-`u64::MAX`-second -/// `grpc-timeout` (e.g. `"18446744073709551615S"`) cannot panic the server on -/// overflow — instead the header is treated as if absent, matching the -/// no-deadline default. +/// Reads `grpc-timeout` into a [`GrpcDeadline`] stored in the request extensions; a timeout +/// that overflows `Instant` counts as absent. pub fn read_grpc_deadline(req: &mut Request) -> Option { let deadline = deadline_from(req.headers(), req.extensions())?; req.extensions_mut().insert(deadline); @@ -107,9 +92,8 @@ impl<'a> FromRequest<'a> for Option { #[cfg(not(feature = "compio"))] type Sleep = Pin>; -/// Compio timers are `!Send`, while response bodies must be `Send`. The timer -/// is created and polled by the connection task that drives the body, which -/// never leaves its runtime thread. +/// Compio timers are `!Send` but bodies must be `Send`; the connection task that polls the +/// body never leaves its runtime thread. #[cfg(feature = "compio")] type Sleep = send_wrapper::SendWrapper>>>; diff --git a/tako-rs-core/src/grpc/web.rs b/tako-rs-core/src/grpc/web.rs index 135c7dc3..0487a717 100644 --- a/tako-rs-core/src/grpc/web.rs +++ b/tako-rs-core/src/grpc/web.rs @@ -1,19 +1,5 @@ -//! gRPC-Web bridge — converts `application/grpc-web+proto` / -//! `application/grpc-web-text` framing to canonical `application/grpc` and -//! back, so browsers reaching a Tako gRPC route can talk to it directly. -//! -//! ⚠️ **Status:** the framing translation is provided as a free function so -//! it can be used inside a custom middleware. A full middleware adapter -//! (request-side decoder + response-side encoder + trailer-as-header -//! envelope) lives in the dev branch as a follow-up to keep this module -//! focused on the byte-level shape. -//! -//! gRPC-Web framing differs from canonical gRPC in two places: -//! -//! 1. **Wire content-type** — `application/grpc-web+proto` (binary) or -//! `application/grpc-web-text` (base64-of-binary). -//! 2. **Trailers** — sent inline as a final `0x80`-flagged frame whose body -//! is `key: value\r\n` lines, instead of HTTP/2 trailers. +//! gRPC-Web framing helpers for a custom middleware: the `-text` flavor is base64 on the +//! wire, and trailers travel as a final `0x80`-flagged frame instead of HTTP trailers. use base64::Engine as _; use base64::engine::general_purpose::STANDARD; @@ -21,31 +7,19 @@ use bytes::Bytes; use bytes::BytesMut; use http::HeaderMap; -/// Identify gRPC-Web requests (binary or text variant). -/// -/// Matches both `application/grpc-web[+proto|+json|…]` and -/// `application/grpc-web-text[…]`. To distinguish the two, use -/// [`is_grpc_web_text`] — it is a strict subset: every content-type for -/// which `is_grpc_web_text` returns `true` also satisfies `is_grpc_web`. +/// Matches every gRPC-Web content type, the `-text` ones included. pub fn is_grpc_web(content_type: &str) -> bool { let ct = content_type.to_ascii_lowercase(); ct.starts_with("application/grpc-web") } -/// Detects the text (base64) flavor of gRPC-Web. -/// -/// Implication: `is_grpc_web_text(ct) ⇒ is_grpc_web(ct)`. Callers that -/// need only "any gRPC-Web variant" should prefer [`is_grpc_web`]; the -/// text check is needed when picking the base64 decoder path. +/// Matches the base64 `-text` flavor. pub fn is_grpc_web_text(content_type: &str) -> bool { let ct = content_type.to_ascii_lowercase(); ct.starts_with("application/grpc-web-text") } -/// Decode a gRPC-Web message body to canonical gRPC framing. -/// -/// For `*-text` messages this base64-decodes the body first; for binary -/// messages the buffer is passed through unchanged. +/// Base64-decodes a `-text` body; a binary body is copied through. pub fn decode_request_body(content_type: &str, body: &[u8]) -> Result { if is_grpc_web_text(content_type) { let decoded = STANDARD @@ -57,36 +31,23 @@ pub fn decode_request_body(content_type: &str, body: &[u8]) -> Result Bytes { let mut payload = String::new(); for (k, v) in trailers { let key_str = k.as_str(); if key_str.ends_with("-bin") { - // Binary trailer: base64-encode raw bytes per gRPC spec. payload.push_str(key_str); payload.push_str(": "); payload.push_str(&STANDARD.encode(v.as_bytes())); payload.push_str("\r\n"); } else if let Ok(s) = v.to_str() { - // ASCII trailer: pass through. payload.push_str(key_str); payload.push_str(": "); payload.push_str(s); payload.push_str("\r\n"); } - // else: non-`-bin` key with non-ASCII value is a malformed gRPC trailer - // (caller bug). Drop silently — same behavior as before, plus a more - // narrow surface. } let payload = payload.into_bytes(); assert!( @@ -100,7 +61,7 @@ pub fn encode_trailer_frame(trailers: &HeaderMap) -> Bytes { frame.freeze() } -/// Wrap a binary gRPC-Web body for the `*-text` flavor (base64 over the wire). +/// Base64-encodes `body` for the `-text` flavor; a binary body passes through. pub fn encode_response_body(content_type: &str, body: Bytes) -> Bytes { if is_grpc_web_text(content_type) { let s = STANDARD.encode(body); diff --git a/tako-rs-core/src/handler.rs b/tako-rs-core/src/handler.rs index d32ad1e1..38b36366 100644 --- a/tako-rs-core/src/handler.rs +++ b/tako-rs-core/src/handler.rs @@ -1,11 +1,6 @@ #![allow(non_snake_case)] -//! Request handler traits and implementations for type-safe HTTP processing. -//! -//! This module provides the core handler abstraction for Tako applications. Handlers are -//! asynchronous functions that process HTTP requests and produce responses. The `Handler` -//! trait enables type-safe request processing with automatic response conversion, while -//! `BoxHandler` provides type erasure for dynamic handler storage and composition. +//! The [`Handler`] trait, implemented for async functions of up to 12 extractors. //! //! # Examples //! @@ -42,12 +37,7 @@ use crate::responder::Responder; use crate::types::Request; use crate::types::Response; -/// Trait for asynchronous HTTP request handlers. -/// -/// The `Handler` trait represents functions that process HTTP requests and produce responses. -/// It is automatically implemented for async functions and closures that take a `Request` -/// and return any type implementing `Responder`. This enables flexible handler composition -/// and type-safe response generation throughout the framework. +/// Implemented for async functions and closures whose arguments are all extractors. /// /// # Examples /// @@ -83,30 +73,19 @@ pub trait Handler: Send + Sync + 'static { /// Framework entries the handler's extractors read. const ENTRIES: Entries = Entries::ALL; - /// Calls the handler with the given request. - /// - /// Returns an unboxed future; `BoxHandler` erases its type, without a heap - /// allocation when the future is small. + /// Returns an unboxed future; `BoxHandler` erases its type without boxing small futures. fn call(self, req: Request) -> impl Future + Send + 'static; } -/// Type-erased handler wrapper for dynamic storage and composition. -/// -/// Handlers can now be written with or without extractor parameters, similar to Axum. -/// For example: `async fn handler() -> impl Responder`, `async fn handler(Json) -> _`, -/// or `async fn handler(Path(p): Path, Query(q): Query) -> _`. +/// A type-erased [`Handler`], cheap to clone. #[derive(Clone)] pub struct BoxHandler { - /// The inner function that processes requests and produces responses. inner: Arc HandlerFuture + Send + Sync>, entries: Entries, } impl BoxHandler { - /// Creates a new boxed handler from any handler implementation. - /// - /// This is the single type-erasure point: `Handler::call` returns an unboxed - /// future, which [`HandlerFuture`] stores inline or boxes. + /// The one type-erasure point; [`HandlerFuture`] keeps small futures inline, boxing the rest. pub(crate) fn new(h: H) -> Self where H: Handler + Clone, @@ -124,7 +103,6 @@ impl BoxHandler { self.entries } - /// Calls the boxed handler with the provided request. pub(crate) fn call(&self, req: Request) -> HandlerFuture { (self.inner)(req) } diff --git a/tako-rs-core/src/handler/future.rs b/tako-rs-core/src/handler/future.rs index 36276b95..274c424e 100644 --- a/tako-rs-core/src/handler/future.rs +++ b/tako-rs-core/src/handler/future.rs @@ -18,11 +18,8 @@ const WORDS: usize = 6; type Slot = MaybeUninit<[usize; WORDS]>; -/// A handler's response future, stored inline when it fits in [`WORDS`] words -/// and boxed otherwise. -/// -/// It is `!Unpin`, so once pinned the inline future never moves again; moving -/// it before the first poll is allowed like for any future. +/// A handler's future, inline when it fits in [`WORDS`] words and boxed otherwise; it is +/// `!Unpin`, so a pinned inline future never moves. pub(crate) struct HandlerFuture { repr: Repr, _pinned: PhantomPinned, diff --git a/tako-rs-core/src/lib.rs b/tako-rs-core/src/lib.rs index a7d9f046..9cfcf206 100644 --- a/tako-rs-core/src/lib.rs +++ b/tako-rs-core/src/lib.rs @@ -1,114 +1,63 @@ #![cfg_attr(docsrs, feature(doc_cfg))] -// `FromRequest::from_request` and `FromRequestParts::from_request_parts` use the -// `fn(...) -> impl Future + Send + 'a` shape on purpose: the explicit `+ Send` -// bound is what lets handlers be hosted by the hyper service trait. Rewriting -// these as `async fn` would drop the bound. +// Extractor impls spell out `-> impl Future + Send`; an `async fn` would not promise `Send`. #![allow(clippy::manual_async_fn)] -//! Internal core for the Tako framework. +//! Routing, handler, extractor and responder primitives shared by the Tako crates. //! -//! This crate hosts the framework primitives shared across all Tako sub-crates: -//! routing, request/response types, body, middleware/plugin traits, extractor -//! traits, state, signals, queue, and a few cross-cutting features such as -//! `graphql`, `grpc`, and `openapi` that interact tightly with the router. -//! -//! Concrete extractors live in `tako-rs-extractors`, server bootstrap code in -//! `tako-rs-server`, streaming/upgrade transports in `tako-rs-streams`, and concrete -//! middleware/plugin implementations in `tako-rs-plugins`. Users should depend on -//! the `tako-rs` umbrella crate, which re-exports everything under the original -//! `tako::*` paths. +//! Depend on the `tako-rs` umbrella crate instead; it re-exports these under `tako::*`. -/// HTTP request and response body handling utilities. pub mod body; - -/// Configuration loading from environment variables. pub mod config; - -/// Request data extraction trait + the two extractors (`json`, `params`) -/// whose internal types are referenced by the router and route. +pub mod conn_info; pub mod extractors; - -/// Request handler traits and implementations. pub mod handler; - -/// Middleware trait + `Next` execution chain. pub mod middleware; +pub mod problem; +pub mod queue; +pub mod redirect; +pub mod responder; +pub mod route; +pub mod router; +pub mod router_state; +pub mod state; +pub mod types; + +mod recycle; + +#[doc(hidden)] +pub mod server_support; -/// Plugin system trait (`TakoPlugin`). #[cfg(feature = "plugins")] #[cfg_attr(docsrs, doc(cfg(feature = "plugins")))] pub mod plugins; -/// Response generation utilities and traits. -pub mod responder; - -/// RFC 7807 / RFC 9457 `application/problem+json` error responses. -pub mod problem; - -/// Unified per-connection metadata extension shared by every transport. -pub mod conn_info; - -/// Shared TLS certificate / key PEM loading helpers. #[cfg(any(feature = "tls", feature = "http3"))] #[cfg_attr(docsrs, doc(cfg(any(feature = "tls", feature = "http3"))))] pub mod tls; -/// Redirection utilities for handling HTTP redirects. -pub mod redirect; - -/// Route definition and matching logic. -pub mod route; - -/// Request routing and dispatch functionality. -pub mod router; - -/// In-memory background job queue with retry, delayed jobs, and dead letter support. -pub mod queue; - -/// Application state management and dependency injection. -pub mod state; - -/// Per-router typed state container (instance-scoped, complements `state`). -pub mod router_state; - #[cfg(feature = "signals")] -/// In-process signal arbiter for custom events. pub mod signals; -/// Distributed tracing integration for observability. #[cfg(feature = "tako-tracing")] #[cfg_attr(docsrs, doc(cfg(feature = "tako-tracing")))] pub mod tracing; -/// Core type definitions used throughout the framework. -pub mod types; - -mod recycle; - -#[doc(hidden)] -pub mod server_support; - -/// `GraphQL` support (request extractors, responses, and subscriptions). #[cfg(feature = "async-graphql")] #[cfg_attr(docsrs, doc(cfg(feature = "async-graphql")))] pub mod graphql; -/// `GraphiQL` UI helpers. #[cfg(feature = "graphiql")] #[cfg_attr(docsrs, doc(cfg(feature = "graphiql")))] pub mod graphiql; -/// `OpenAPI` documentation generation integrations (utoipa, vespera). #[cfg(any(feature = "utoipa", feature = "vespera"))] #[cfg_attr(docsrs, doc(cfg(any(feature = "utoipa", feature = "vespera"))))] pub mod openapi; -/// gRPC over HTTP/2: unary and streaming RPCs with protobuf messages. #[cfg(feature = "grpc")] #[cfg_attr(docsrs, doc(cfg(feature = "grpc")))] pub mod grpc; -/// WebSocket upgrades and connections. #[cfg(feature = "ws")] #[cfg_attr(docsrs, doc(cfg(feature = "ws")))] pub mod ws; diff --git a/tako-rs-core/src/middleware.rs b/tako-rs-core/src/middleware.rs index d58e9b4a..086e6764 100644 --- a/tako-rs-core/src/middleware.rs +++ b/tako-rs-core/src/middleware.rs @@ -1,9 +1,4 @@ -//! Middleware system for request and response processing pipelines. -//! -//! This module provides the core middleware infrastructure for Tako, allowing you to -//! compose request processing pipelines. Middleware can modify requests, responses, -//! or perform side effects like logging, authentication, or rate limiting. The `Next` -//! struct manages the execution flow through the middleware chain to the final handler. +//! [`Next`], the rest of a middleware chain, and the [`IntoMiddleware`] conversion. //! //! # Examples //! @@ -26,11 +21,7 @@ use crate::types::BoxMiddleware; use crate::types::Request; use crate::types::Response; -/// Trait for converting types into middleware functions. -/// -/// This trait allows various types to be converted into middleware that can be used -/// in the Tako middleware pipeline. Middleware functions take a request and the next -/// middleware in the chain, returning a future that resolves to a response. +/// Converts a configured value into a middleware closure for `Router::middleware`. /// /// # Examples /// @@ -66,20 +57,13 @@ pub trait IntoMiddleware { + 'static; } -/// Represents the next step in the middleware execution chain. -/// -/// `Next` is passed to middleware functions to allow them to continue -/// the request processing chain. Calling `next.run(req)` will execute -/// the remaining middleware and eventually the endpoint handler. +/// The rest of the chain; `next.run(req)` runs the remaining middleware, then the handler. #[doc(alias = "next")] pub struct Next { - /// Global middlewares to be executed before route-specific ones. pub(crate) global_middlewares: Arc>, - /// Route-specific middlewares executed after global ones. pub(crate) route_middlewares: Arc>, - /// Current position within the middleware chain. + /// Position in `global_middlewares` followed by `route_middlewares`. pub(crate) index: usize, - /// Final endpoint handler to be called after all middlewares. pub(crate) endpoint: BoxHandler, } diff --git a/tako-rs-core/src/openapi.rs b/tako-rs-core/src/openapi.rs index 8d01c72e..263291f4 100644 --- a/tako-rs-core/src/openapi.rs +++ b/tako-rs-core/src/openapi.rs @@ -1,23 +1,7 @@ -//! `OpenAPI` documentation generation integrations. +//! `OpenAPI` route metadata plus two spec backends: `utoipa` (derive macros, recommended) and +//! `vespera` (a spec built at runtime, also from the routes' metadata). //! -//! Tako ships two integration backends; pick exactly one per project: -//! -//! - **`utoipa` — primary, recommended**. Compile-time `OpenAPI` generation via -//! derive macros, mature ecosystem, broad community use. Enable with the -//! `utoipa` cargo feature. -//! - **`vespera` — legacy / advanced**. Hand-rolled `OpenAPI` 3.1 builder plus -//! route discovery. Kept opt-in for users who need the runtime spec model -//! that `utoipa` does not provide. Enable with the `vespera` feature. -//! -//! Both backends share the same [`RouteOpenApi`](crate::openapi::RouteOpenApi) metadata attached on the -//! `Router::route(...)` builder via `summary` / `description` / `tag` / -//! `response`. The `OpenAPI` documents themselves are produced by whichever -//! backend the application enables; do not enable both unless you are -//! intentionally cross-validating the output. -//! -//! # Route-Level Integration -//! -//! Both integrations support route-level `OpenAPI` metadata: +//! # Examples //! //! ```rust,ignore //! use tako::{router::Router, Method}; @@ -31,10 +15,6 @@ //! .response(404, "User not found"); //! ``` //! -//! # Examples -//! -//! ## Using utoipa -//! //! ```rust,ignore //! use tako::openapi::utoipa::{OpenApi, OpenApiJson, ToSchema}; //! @@ -53,8 +33,6 @@ //! } //! ``` //! -//! ## Using vespera -//! //! ```rust,ignore //! use tako::openapi::vespera::{OpenApi, Info, VesperaOpenApiJson}; //! @@ -73,46 +51,30 @@ use std::collections::BTreeMap; -/// `OpenAPI` metadata that can be attached to a route. -/// -/// This struct stores operation-level `OpenAPI` information that can be -/// used to generate `OpenAPI` specifications from Tako routes. +/// `OpenAPI` operation metadata of one route. #[derive(Clone, Debug, Default)] pub struct RouteOpenApi { - /// Unique identifier for the operation. pub operation_id: Option, - /// Short summary of the operation. pub summary: Option, - /// Detailed description of the operation. pub description: Option, - /// Tags for grouping operations. pub tags: Vec, - /// Whether the operation is deprecated. pub deprecated: bool, - /// Response descriptions keyed by status code. + /// Response description per status code. pub responses: BTreeMap, - /// Parameter descriptions. pub parameters: Vec, - /// Request body description. pub request_body: Option, - /// Security requirements. + /// Names of the security schemes the operation requires. pub security: Vec, } -/// `OpenAPI` parameter definition. #[derive(Clone, Debug, Default)] pub struct OpenApiParameter { - /// Parameter name. pub name: String, - /// Parameter location (query, header, path, cookie). pub location: ParameterLocation, - /// Parameter description. pub description: Option, - /// Whether the parameter is required. pub required: bool, } -/// Location of an `OpenAPI` parameter. #[derive(Clone, Debug, Default)] pub enum ParameterLocation { #[default] @@ -122,27 +84,21 @@ pub enum ParameterLocation { Cookie, } -/// `OpenAPI` request body definition. #[derive(Clone, Debug, Default)] pub struct OpenApiRequestBody { - /// Description of the request body. pub description: Option, - /// Whether the request body is required. pub required: bool, - /// Content type (e.g., "application/json"). + /// Media type such as `application/json`. pub content_type: String, - /// Schema properties for the request body (name, type, description). + /// Top-level properties of the body's object schema. pub schema_properties: Vec, } -/// A property definition for request body schema. #[derive(Clone, Debug, Default)] pub struct RequestBodyProperty { - /// Property name. pub name: String, - /// Property type (e.g., "string", "integer", "boolean"). + /// JSON Schema type such as `string`, `integer` or `boolean`. pub property_type: String, - /// Property description. pub description: Option, } @@ -154,5 +110,4 @@ pub mod utoipa; #[cfg_attr(docsrs, doc(cfg(feature = "vespera")))] pub mod vespera; -/// `OpenAPI` UI helpers (Swagger UI, Scalar, `RapiDoc`, `Redoc`). pub mod ui; diff --git a/tako-rs-core/src/openapi/ui.rs b/tako-rs-core/src/openapi/ui.rs index 71eb7532..55da25ab 100644 --- a/tako-rs-core/src/openapi/ui.rs +++ b/tako-rs-core/src/openapi/ui.rs @@ -1,11 +1,4 @@ -//! `OpenAPI` UI helpers for serving interactive API documentation. -//! -//! This module provides responders for serving popular `OpenAPI` UI interfaces: -//! - **Swagger UI**: The classic `OpenAPI` documentation interface -//! - **Scalar**: A modern, beautiful API documentation UI -//! - **`RapiDoc`**: A feature-rich API documentation viewer -//! -//! All UIs are served via CDN, requiring no additional dependencies. +//! Responders for Swagger UI, Scalar, `RapiDoc` and `Redoc` pages, which load the UI from a CDN. //! //! # Examples //! diff --git a/tako-rs-core/src/openapi/ui/escape.rs b/tako-rs-core/src/openapi/ui/escape.rs index 3dab073b..20934632 100644 --- a/tako-rs-core/src/openapi/ui/escape.rs +++ b/tako-rs-core/src/openapi/ui/escape.rs @@ -1,13 +1,4 @@ -//! Context-aware escaping helpers shared by the `OpenAPI` UI responders. - -/// HTML-escape user-controlled text for safe interpolation into HTML text -/// nodes *or* double-quoted attribute values. Protects against the obvious -/// XSS sinks if `title` / `spec_url` ever originate from request parameters -/// (e.g. `Router::get("/docs/:title", ...)`). -/// -/// Escapes `&`, `<`, `>`, `"`, and `'` to the corresponding HTML entities — -/// the minimal set that closes both element-context and attribute-context -/// injection. +/// Escapes `&`, `<`, `>`, `"` and `'`, so `s` is safe in HTML text and quoted attributes. pub(crate) fn html_escape(s: &str) -> String { let mut out = String::with_capacity(s.len()); for c in s.chars() { @@ -23,13 +14,9 @@ pub(crate) fn html_escape(s: &str) -> String { out } -/// Escape `s` for use as a JavaScript string literal — including the -/// surrounding double quotes. Used for `url: {js}` / `theme: {js}` sinks in -/// `", + "/openapi.json", + "/openapi.json