1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
mod attachment;
mod binary;
mod event_stream;
mod html;
mod json;
mod plain_text;
mod response;
use poem::{Request, RequestBody, Result};
pub use self::{
attachment::Attachment, binary::Binary, event_stream::EventStream, html::Html, json::Json,
plain_text::PlainText, response::Response,
};
use crate::registry::{MetaSchemaRef, Registry};
pub trait Payload: Send {
const CONTENT_TYPE: &'static str;
fn schema_ref() -> MetaSchemaRef;
#[allow(unused_variables)]
fn register(registry: &mut Registry) {}
}
#[poem::async_trait]
pub trait ParsePayload: Sized {
const IS_REQUIRED: bool;
async fn from_request(request: &Request, body: &mut RequestBody) -> Result<Self>;
}