poem_openapi::payload

Trait Payload

Source
pub trait Payload: Send {
    const CONTENT_TYPE: &'static str;

    // Required method
    fn schema_ref() -> MetaSchemaRef;

    // Provided methods
    fn check_content_type(content_type: &str) -> bool { ... }
    fn register(registry: &mut Registry) { ... }
}
Expand description

Represents a payload type.

Required Associated Constants§

Source

const CONTENT_TYPE: &'static str

The content type of this payload.

Required Methods§

Source

fn schema_ref() -> MetaSchemaRef

Gets schema reference of this payload.

Provided Methods§

Source

fn check_content_type(content_type: &str) -> bool

Check the content type of incoming request

Source

fn register(registry: &mut Registry)

Register the schema contained in this payload to the registry.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Type> Payload for Form<T>

Source§

const CONTENT_TYPE: &'static str = "application/x-www-form-urlencoded"

Source§

impl<T: Type> Payload for Json<T>

Source§

const CONTENT_TYPE: &'static str = "application/json; charset=utf-8"

Source§

impl<T: Type> Payload for Xml<T>

Source§

const CONTENT_TYPE: &'static str = "application/xml; charset=utf-8"

Source§

impl<T: Type> Payload for Yaml<T>

Source§

const CONTENT_TYPE: &'static str = "application/yaml; charset=utf-8"

Source§

impl<T: Into<Body> + Send> Payload for Attachment<T>

Source§

const CONTENT_TYPE: &'static str = Binary<T>::CONTENT_TYPE

Source§

impl<T: Send> Payload for Base64<T>

Source§

const CONTENT_TYPE: &'static str = "text/plain; charset=utf-8"

Source§

impl<T: Send> Payload for Binary<T>

Source§

const CONTENT_TYPE: &'static str = "application/octet-stream"

Source§

impl<T: Send> Payload for Html<T>

Source§

const CONTENT_TYPE: &'static str = "text/html; charset=utf-8"

Source§

impl<T: Send> Payload for PlainText<T>

Source§

const CONTENT_TYPE: &'static str = "text/plain; charset=utf-8"

Source§

impl<T: Stream<Item = E> + Send + 'static, E: Type + ToJSON> Payload for EventStream<T>

Source§

const CONTENT_TYPE: &'static str = "text/event-stream"