Skip to main content

Crate wx_rust_common

Crate wx_rust_common 

Source
Expand description

WxRust 公共基础设施 crate。

对应 Java me.chanjar.weixin.common 模块,为各业务 crate 提供:

  • 错误模型(WxError / WxErrorException / 分平台错误码翻译表)
  • 数据对象(access token、jsapi 签名、OCR、菜单、订阅消息等)
  • 会话管理、重复消息检查、请求执行器抽象、配置存储抽象
  • HTTP 传输抽象与统一执行管线(token 注入 + 失效单次重放)
  • per-host 熔断器(可选注入,默认关闭)
  • 可注入时钟(WxClock:默认 SystemClock,测试可注入 FakeClock
  • 加密工具(SHA1 / 微信消息加解密 / PKCS7)

设计约束:全 crate #![forbid(unsafe_code)],HTTP 统一使用 reqwest

Re-exports§

pub use error::WxError;
pub use error::WxErrorException;
pub use error::WxRuntimeError;

Modules§

annotation
字段校验注解。
api
公共 API 抽象。
bean
公共数据对象。
circuit
per-host 熔断器(零第三方依赖自写,不引 tower 等)。
clock
可注入时钟抽象(WxClock)。
config
微信客户端配置存储抽象。
enums
微信枚举。
error
错误模型。
executor
通用执行器。
http
HTTP 传输抽象层。
pipeline
统一执行管线。
redis
Redis 操作抽象。
service
服务接口。
session
会话管理。
util
工具类。