JsonDeserializer extractor for zero-copy deserialization (#2431)

This commit is contained in:
future-highway
2023-12-29 12:06:47 +01:00
committed by GitHub
parent c3db223532
commit 56159b0d4e
6 changed files with 462 additions and 2 deletions
+2 -2
View File
@@ -12,12 +12,12 @@ use serde::{de::DeserializeOwned, Serialize};
/// JSON Extractor / Response.
///
/// When used as an extractor, it can deserialize request bodies into some type that
/// implements [`serde::Deserialize`]. The request will be rejected (and a [`JsonRejection`] will
/// implements [`serde::de::DeserializeOwned`]. The request will be rejected (and a [`JsonRejection`] will
/// be returned) if:
///
/// - The request doesn't have a `Content-Type: application/json` (or similar) header.
/// - The body doesn't contain syntactically valid JSON.
/// - The body contains syntactically valid JSON but it couldn't be deserialized into the target
/// - The body contains syntactically valid JSON, but it couldn't be deserialized into the target
/// type.
/// - Buffering the request body fails.
///