docs.rs failed to build sa-token-plugin-actix-web-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
sa-token-plugin-actix-web-0.1.18
Sa-Token Actix-Web Plugin
这个包提供了 Sa-Token 与 Actix-Web 框架的集成。
简单使用方式
// 在你的 Cargo.toml 中添加依赖
// sa-token-plugin-actix-web = { version = "0.2.0", features = ["redis"] }
use ;
use ;
// 初始化 Sa-Token 配置
// 使用中间件保护路由
async
// 登录接口
async
// 需要登录才能访问的接口
async
// 需要 admin 角色才能访问的接口
async
特性 (Features)
memory- 使用内存存储 (默认)redis- 使用 Redis 存储database- 使用数据库存储full- 包含所有存储后端
直接引用方式
在你的项目中,只需要添加以下依赖即可使用 Sa-Token 与 Actix-Web 的集成:
[]
= { = "0.2.0", = ["redis"] }
这个依赖会自动包含所有必要的 Sa-Token 组件,包括核心功能和存储实现。
共享类型在 sa-token-plugin-common,由本 crate 再导出。