Skip to main content

Crate tako

Crate tako 

Source
Expand description

A multi-transport Rust framework for modern network services.

Tako is built for services that go beyond plain HTTP. It gives you one cohesive model for routing, extraction, middleware, streaming, observability, and graceful shutdown across several protocols and transport layers.

This umbrella crate stitches together the workspace sub-crates:

  • tako-core — routing, handlers, middleware and plugin traits, body and request types, state, signals, queue, plus GraphQL, gRPC and OpenAPI helpers
  • tako-extractors — concrete request extractors (cookies, form, query, path, JWT, multipart, simdjson, …)
  • tako-server — HTTP/1, TLS, HTTP/3, raw TCP / UDP / Unix, PROXY protocol, plus the compio variants
  • tako-streams — WebSocket, SSE, file streaming, static file serving, WebTransport
  • tako-plugins — built-in middleware (auth, CSRF, sessions, …) and plugins (CORS, compression, rate limiting, idempotency, metrics)

All public types stay reachable at the original tako::* paths.

Modules§

body
HTTP request and response body handling utilities. HTTP request and response body handling utilities for efficient data processing.
config
Configuration loading from environment variables. Configuration loading from environment variables.
conn_info
Unified per-connection metadata extension shared by every transport. Unified connection-info extension shared by every Tako transport.
extractors
Request data extraction utilities.
file_streamfile-stream
File streaming utilities for serving files. File streaming utilities for efficient HTTP file delivery.
graphiqlgraphiql
GraphiQL UI helpers. GraphiQL HTML responder and helper for Tako.
graphqlasync-graphql
GraphQL support (request extractors, responses, and subscriptions). Async-GraphQL integration for Tako: extractors, responses, and subscriptions.
grpcgrpc
gRPC support for unary RPCs with protobuf serialization. gRPC support for unary RPCs over HTTP/2.
header
HTTP header types
middleware
Middleware for processing requests and responses in a pipeline.
openapiutoipa or vespera
OpenAPI documentation generation integrations (utoipa, vespera). OpenAPI documentation generation integrations.
pluginsplugins
prelude
Re-exports of the types most handlers reach for in everyday code.
problem
RFC 7807 / RFC 9457 application/problem+json error responses. RFC 7807 / RFC 9457 application/problem+json error responses.
queue
In-memory background job queue with retry, delayed jobs, and dead letter support. In-memory background job queue with named queues, retry policies, and dead letter support.
redirect
Redirection utilities for handling HTTP redirects. Redirect response utilities for handlers.
responder
Response generation utilities and traits. Response generation utilities and trait implementations for HTTP responses.
route
Route definition and matching logic. HTTP route definition and path matching functionality.
router
Request routing and dispatch functionality. HTTP request routing and dispatch functionality.
router_state
Per-router typed state container (instance-scoped, complements state). Per-router typed state container.
server_compiocompio
server_tcp
Raw TCP server for handling arbitrary TCP connections. Raw TCP server for handling arbitrary TCP connections.
server_tls_compiocompio-tls
TLS-enabled HTTP server implementation for secure connections (compio runtime).
server_udp
UDP datagram server for handling raw UDP packets. UDP datagram server for handling raw UDP packets.
signalssignals
In-process signal arbiter for custom events. In-process signal arbiter and dispatch system.
sse
Server-Sent Events (SSE) support for real-time communication. Server-Sent Events (SSE) implementation conforming to the W3C EventSource specification.
state
Application state management and dependency injection. Global application state management and dependency injection (type-based).
static
Static file serving utilities. Static file serving utilities for web applications.
stores
Pluggable backend traits for stateful middleware (sessions, rate limiting, …).
tracingtako-tracing
Distributed tracing integration for observability. Distributed tracing integration for observability and debugging.
types
Core type definitions used throughout the framework. Core type definitions and aliases used throughout the Tako framework.
ws_compiocompio-ws
WebSocket connection handling for compio runtime. WebSocket connection handling for compio runtime.
zero_copy_extractorszero-copy-extractors
Zero-copy extraction helpers. Zero-copy extractor variants.

Structs§

AcceptBackoff
Exponential backoff state for listener.accept() retry loops.
Bytes
A cheaply cloneable and sliceable chunk of contiguous memory.
CompioServercompio
Compio-runtime server entry point. Construct with CompioServer::builder.
CompioServerBuildercompio
Fluent constructor for the compio-runtime CompioServer.
Full
A body that consists of a single chunk.
Method
The Request Method (VERB)
PerThreadConfigper-thread
Configuration for serve_per_thread (and the compio variant when enabled).
ServerConfig
Production-readiness knobs shared by every Tako server transport.
ServerHandle
Background-task handle returned by every spawn_* method.
StatusCode
An HTTP status code (status-code in RFC 9110 et al.).

Enums§

TlsCert
Optional TLS material the builder can attach to a TLS-mode server.

Constants§

NOT_FOUND
A default 404 Not Found response.

Functions§

bind_with_port_fallback
Bind a TCP listener for addr, asking interactively to increment the port if it is already in use (compio version).
serve
serve_per_threadper-thread
Starts a thread-per-core HTTP server with the given router.
serve_per_thread_compioper-thread-compio
Starts a thread-per-core HTTP server with the compio runtime.
serve_tlscompio-tls or tls
Starts a TLS-enabled HTTP server with the given listener, router, and certificates.
serve_tls_with_shutdowncompio-tls or tls
Starts a TLS-enabled HTTP server (compio) with graceful shutdown support.
serve_with_shutdown
Starts the Tako HTTP server (compio) with graceful shutdown support.

Attribute Macros§

delete
#[delete("/path", [name = "Foo"])] — shorthand for #[route(DELETE, ...)].
get
#[get("/path", [name = "Foo"])] — shorthand for #[route(GET, ...)].
patch
#[patch("/path", [name = "Foo"])] — shorthand for #[route(PATCH, ...)].
post
#[post("/path", [name = "Foo"])] — shorthand for #[route(POST, ...)].
put
#[put("/path", [name = "Foo"])] — shorthand for #[route(PUT, ...)].
route