Skip to main content

sz_rust_infra_facade/
lib.rs

1//! SZ-Rust Infrastructure Facade
2//!
3//! 提取自 `sz-rust-core` 的基础设施模块,提供配置、验证、静态文件、上传、调试页五大能力。
4//!
5//! ## 模块结构
6//!
7//! | 模块 | 对齐 PHP | 说明 |
8//! |------|---------|------|
9//! | [`config`] | `think\Config` | 配置加载(serde YAML + 环境变量覆盖 + 热重载) |
10//! | [`validate`] | `think\Validate` | 数据验证器(规则链 + 自定义规则 + 批量验证) |
11//! | [`static_files`] | `think\middleware\StaticFile` | 静态文件路由(`tower-http::ServeDir`) |
12//! | [`upload`] | `think\File` + `think\file\UploadedFile` | 文件上传(Multipart + 校验 + 存储) |
13//! | [`debug_page`] | `whoops` / `think\exception\Handle` | 调试页(开发 HTML + 生产 JSON) |
14//!
15//! ## 用法
16//!
17//! ```ignore
18//! use sz_rust_infra_facade::config::Config;
19//! use sz_rust_infra_facade::validate::{Validate, Rule};
20//! use sz_rust_infra_facade::static_files::static_route;
21//! ```
22//!
23//! ## 与 sz-rust-core 的关系
24//!
25//! `sz-rust-core` 通过 `pub use sz_rust_infra_facade as infra;` 重导出本 crate,
26//! 因此 `sz_rust_core::infra::config` 等价于 `sz_rust_infra_facade::config`。
27//! 下游业务包推荐直接依赖 `sz-rust-infra-facade` 以减少编译耦合。
28
29#![deny(unsafe_code)]
30#![warn(missing_docs)]
31
32pub mod config;
33pub mod debug_page;
34pub mod static_files;
35pub mod upload;
36pub mod validate;