-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
124 lines (103 loc) · 2.77 KB
/
Cargo.toml
File metadata and controls
124 lines (103 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
[workspace]
resolver = "2"
members = [
"crates/shared",
"services/gateway",
"services/svc-user",
"services/svc-content",
"services/svc-notification",
"services/migration",
]
[workspace.package]
version = "0.1.0"
edition = "2024"
license = "MIT"
[workspace.dependencies]
# 共享库
shared = { path = "crates/shared" }
# Async runtime
tokio = { version = "1", features = ["full"] }
async-trait = "0.1"
# gRPC / Protobuf
tonic = "0.14"
tonic-prost = "0.14"
tonic-reflection = "0.14"
tonic-web = "0.14"
tonic-health = "0.14"
prost = "0.14"
prost-types = "0.14"
# HTTP / Web framework
axum = { version = "0.8", features = ["macros"] }
tower = "0.5"
tower-http = { version = "0.6", features = ["cors", "trace", "request-id", "util"] }
# Serialization
serde = { version = "1", features = ["derive"] }
serde_json = "1"
# Configuration
dotenvy = "0.15"
# Logging / Tracing
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
# Error handling
thiserror = "2"
anyhow = "1"
# Service discovery (Consul HTTP API)
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
# Messaging (NATS)
async-nats = "0.38"
futures = "0.3"
# Utilities
uuid = { version = "1", features = ["v4"] }
hostname = "0.4"
chrono = { version = "0.4", features = ["serde"] }
# Auth
jsonwebtoken = "9"
bcrypt = "0.16"
# ORM / Database
sea-orm = { version = "1", features = ["runtime-tokio-rustls", "sqlx-postgres", "with-uuid", "with-chrono", "postgres-array"] }
sea-orm-migration = { version = "1", features = ["runtime-tokio-rustls", "sqlx-postgres"] }
# Cache (Redis)
redis = { version = "0.27", features = ["tokio-comp", "connection-manager"] }
deadpool-redis = "0.18"
base64 = "0.22"
# API Documentation
utoipa = { version = "5", features = ["axum_extras"] }
utoipa-swagger-ui = { version = "9", features = ["axum", "vendored"] }
# ========================
# Workspace Lints
# ========================
[workspace.lints.rust]
unsafe_code = "forbid"
unused_must_use = "deny"
# 开发阶段允许未使用的导入和死代码(Proto 生成的 Schema alias、预留的 DTO 等)
dead_code = "allow"
unused_imports = "allow"
unused_variables = "allow"
[workspace.lints.clippy]
# 代码质量
pedantic = { level = "warn", priority = -1 }
# 允许的例外
module_name_repetitions = "allow"
must_use_candidate = "allow"
missing_errors_doc = "allow"
missing_panics_doc = "allow"
# 禁止
unwrap_used = "warn"
expect_used = "warn"
panic = "warn"
todo = "warn"
dbg_macro = "warn"
# ========================
# Profile 优化
# ========================
[profile.dev]
opt-level = 0
debug = true
[profile.dev.package."*"]
# 依赖包用 release 编译加速运行
opt-level = 2
[profile.release]
opt-level = 3
lto = "thin"
strip = "symbols"
codegen-units = 1