You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`TonicCompatibleHandlerWrapper<F>`| Tonic-style unary with axum extractors |
116
-
|`TonicCompatibleStreamHandlerWrapper<F>`| Tonic-style streaming with axum extractors |
118
+
|`TonicCompatibleStreamHandlerWrapper<F>`| Tonic-style server streaming with axum extractors |
119
+
|`TonicCompatibleClientStreamHandlerWrapper<F>`| Tonic-style client streaming with axum extractors |
120
+
|`TonicCompatibleBidiStreamHandlerWrapper<F>`| Tonic-style bidi streaming with axum extractors |
121
+
122
+
### How Handler Wrappers Work
123
+
124
+
`ConnectHandlerWrapper<F>` is a newtype that wraps a user function `F`. It has multiple `impl Handler<T, S>` blocks, each with different `where` bounds on `F`:
125
+
126
+
```rust
127
+
// When F returns ConnectResponse<Resp> (not StreamBody)
The compiler inspects `F`'s signature (input types + return type) and selects the impl whose `where` bounds match. The `T` parameter in `Handler<T, S>` acts as a discriminator tag - it's not used at runtime, only for impl selection.
117
139
118
140
## Builder Pattern
119
141
@@ -196,14 +218,27 @@ connectrpc-axum-examples/ # Examples and test clients
196
218
| Module | Purpose |
197
219
|--------|---------|
198
220
|`tonic.rs`|`ContentTypeSwitch` and `TonicCompatible` types |
199
-
|`tonic/handler.rs`| Tonic-compatible handler wrappers and factory traits |
221
+
|`tonic/handler.rs`| Tonic-compatible handler wrappers, factory traits, and boxed call types|
200
222
|`tonic/parts.rs`|`RequestContext`, `CapturedParts`, and `FromRequestPartsLayer`|
201
223
202
224
The tonic module provides two key capabilities:
203
225
204
226
1.**Protocol switching**: `ContentTypeSwitch` routes by Content-Type header between gRPC and Connect
205
227
2.**Extractor support**: `FromRequestPartsLayer` captures HTTP request parts for use with axum's `FromRequestParts` extractors in tonic-style handlers
206
228
229
+
#### Boxed Call Types
230
+
231
+
The tonic module defines boxed callable types for generated service code:
232
+
233
+
| Type | Purpose |
234
+
|------|---------|
235
+
|`BoxedCall<Req, Resp>`| Unary RPC callable |
236
+
|`BoxedStreamCall<Req, Resp>`| Server streaming RPC callable |
Each has corresponding factory traits (`IntoFactory`, `IntoStreamFactory`, `IntoClientStreamFactory`, `IntoBidiStreamFactory`) for adapting user handlers.
241
+
207
242
### context/ module
208
243
209
244
| Module | Purpose |
@@ -217,7 +252,7 @@ The tonic module provides two key capabilities:
Copy file name to clipboardExpand all lines: docs/guide/development.md
+1-10Lines changed: 1 addition & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,13 +33,4 @@ This project includes several [Claude Code skills](https://docs.anthropic.com/en
33
33
|`submit-issue`| Handle questions, feature requests, and bug reports. Attempts to answer from documentation first, verifies bugs with tests, then submits GitHub issues when needed. |
34
34
|`test`| Run the complete test suite including unit tests, doc tests, and Go client integration tests. |
35
35
|`compare-repo`| Compare an external GitHub repository against connectrpc-axum. Analyzes features, architecture, and implementation to generate a comparison document. |
36
-
|`sync-arch-doc`| Sync architecture documentation with main branch changes. Tracks the `docs/arch` branch against `origin/main` and updates architecture docs accordingly. |
37
-
38
-
### Reference Skills
39
-
40
-
These skills are used automatically by Claude when relevant:
41
-
42
-
| Skill | Description |
43
-
|-------|-------------|
44
-
|`connect-go-reference`| Reference the local `connect-go/` directory for ConnectRPC protocol details. Always uses local files instead of fetching from GitHub. |
45
-
|`architecture`| Quick reference to project architecture at `docs/guide/architecture.md`. Use when understanding codebase structure, module organization, or key types. |
36
+
|`sync-arch-doc`| Sync architecture documentation with main branch changes. Tracks the `docs/arch` branch against `main` and updates architecture docs accordingly. |
0 commit comments