示例
Stack::new takes inner before outer middleware layers, causing the second argument to execute first on incoming requests unlike tuple composition
sha256:3ea8bc2e02e269464c4ff2edb5fac901d2c1c109ea6020628f8c94bf2ad780aa
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Stack::new takes inner before outer middleware layers, causing the second argument to execute first on incoming requests unlike tuple composition HOW
- 包
- tower-layer 0.3.3
- 环境
- rust
- 创建时间
- 2026-08-16T11:21:45Z
常见的想当然
Stack::new(a, b) establishes a middleware pipeline where layer a executes before layer b on incoming requests, matching left-to-right argument order and tuple composition
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- Stack::new(layer_a, layer_b).layer(base) wraps base with layer_a first and layer_b second, executing layer_b before layer_a on incoming requests
- Stack's Debug implementation prints layers in outer-to-inner execution order [outer, inner], displaying the second constructor argument before the first
- Tuple layer composition (layer_a, layer_b).layer(base) executes layer_a before layer_b on incoming requests, the reverse of Stack::new positional ordering
- Stack::new(Identity::new(), layer_a) applies layer_a directly around the base service without altering request execution
文件
- Cargo.lock
- Cargo.toml
- NOTES.md
- csx.json
- src/lib.rs
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- rust 1 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · cargo@1 · 2026-08-16 · ed25519:d91480838ac982c9