|
323 | 323 | //!
|
324 | 324 | //! * [`Query`]`<Q>` extracts parameters from a query string, deserializing them
|
325 | 325 | //! into an instance of type `Q`. `Q` must implement `serde::Deserialize` and
|
326 |
| -//! `schemars::JsonSchema`. |
| 326 | +//! `schemars::JsonSchema`. See below for additional restrictions. |
327 | 327 | //! * [`Path`]`<P>` extracts parameters from HTTP path, deserializing them into
|
328 | 328 | //! an instance of type `P`. `P` must implement `serde::Deserialize` and
|
329 |
| -//! `schemars::JsonSchema`. |
| 329 | +//! `schemars::JsonSchema`. See below for additional restrictions. |
330 | 330 | //! * [`Header`]`<H>` extracts parameters from HTTP headers, deserializing
|
331 | 331 | //! them into an instance of type `H`. `H` must implement
|
332 |
| -//! `serde::Deserialize` and `schemars::JsonSchema`. |
| 332 | +//! `serde::Deserialize` and `schemars::JsonSchema`. See below for additional |
| 333 | +//! restrictions. |
333 | 334 | //! * [`TypedBody`]`<J>` extracts content from the request body by parsing the
|
334 | 335 | //! body as JSON (or form/url-encoded) and deserializing it into an instance
|
335 | 336 | //! of type `J`. `J` must implement `serde::Deserialize` and `schemars::JsonSchema`.
|
|
340 | 341 | //! hope is that this would generally not be needed. It can be useful to
|
341 | 342 | //! implement functionality not provided by Dropshot.
|
342 | 343 | //!
|
| 344 | +//! Generally, the type parameter for the `Query`, `Header`, and `Path` extractors |
| 345 | +//! should be Rust structs. The struct's field _names_ correspond to the keys in |
| 346 | +//! the thing being extracted (i.e., they correspond to qquery parameter names |
| 347 | +//! for `Query`, header names for `Header`, and path component names for `Path`). |
| 348 | +//! The struct's field _values_ should generally be Rust primitives, strings, |
| 349 | +//! or enums containing no data. |
| 350 | +//! There is no facility for automatically parsing the values _again_ (e.g., |
| 351 | +//! as JSON), which means nested values or enums with data cannot be supported. |
| 352 | +//! |
343 | 353 | //! `Query` and `Path` impl `SharedExtractor`. `TypedBody`, `UntypedBody`,
|
344 | 354 | //! `StreamingBody`, and `RawRequest` impl `ExclusiveExtractor`. Your function
|
345 | 355 | //! may accept 0-5 extractors, but only one can be `ExclusiveExtractor`, and it
|
|
0 commit comments