Configs2026年7月1日·1 分钟阅读

Tide — Async Web Framework for Rust

Tide is an asynchronous web framework for Rust that provides a minimal, composable API inspired by Express and Koa for building HTTP servers with async/await and the async-std runtime.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Tide Rust Framework
直接安装命令
npx -y tokrepo@latest install 47377ef8-7569-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Tide is an async web framework for Rust built on the async-std runtime. It provides a small, composable API for defining HTTP endpoints with middleware, state management, and streaming support. Tide aims to make async Rust web development approachable by offering a clean, Express-inspired interface.

What Tide Does

  • Defines HTTP routes with async handler functions that return Result types
  • Supports middleware composition for logging, CORS, sessions, and error handling
  • Manages application state via a shared State type available in all handlers
  • Handles streaming request and response bodies for large payloads
  • Provides built-in support for JSON, form data, and file serving

Architecture Overview

Tide is built on async-std and http-types. Requests flow through a middleware stack, then match against a route trie. Each handler receives a Request object containing the shared application state, extracts parameters or body data, and returns a Response. The framework is single-threaded per listener by default but can be wrapped in multi-listener setups for concurrency.

Self-Hosting & Configuration

  • Requires Rust 1.65+ with the 2021 edition
  • Add tide and async-std to Cargo.toml dependencies
  • Initialize with tide::new() or tide::with_state(state) for shared state
  • Bind to address with app.listen("0.0.0.0:8080").await
  • Deploy as a compiled binary; pair with a reverse proxy for TLS

Key Features

  • Clean async/await API reduces the complexity of asynchronous Rust code
  • Shared application state is type-safe and available in every handler
  • Middleware is composable with before, after, and around hooks
  • Nested routes and route prefixes keep endpoint definitions organized
  • Server-Sent Events support for real-time push from server to client

Comparison with Similar Tools

  • Actix Web — more mature with higher throughput; Tide prioritizes API simplicity
  • Axum — Tokio-based with extractor pattern; Tide uses async-std runtime
  • Rocket — macro-driven with compile-time checks; Tide is more lightweight
  • Warp — filter-based composition; Tide uses traditional route-and-handler style
  • Poem — feature-rich with OpenAPI support; Tide is more minimal

FAQ

Q: Why does Tide use async-std instead of Tokio? A: Tide was built by the async-std team as a showcase for the runtime. It embraces async-std's task model and I/O traits.

Q: Is Tide production-ready? A: Tide is usable for production workloads but has not reached 1.0. Evaluate stability requirements before choosing it for critical services.

Q: Can I use Tide with Tokio? A: Tide is designed for async-std. For Tokio-based projects, Axum or Actix Web are better fits.

Q: Does Tide support WebSockets? A: WebSocket support is available via the tide-websockets crate as a middleware extension.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产