Skip to main content

OpenApiOutputAlg

Trait OpenApiOutputAlg 

Source
pub trait OpenApiOutputAlg<From> {
    // Required method
    fn answers(schema: &JsonSchemaShape) -> Vec<OpenApiAnswer>;
}
Expand description

States how a document describes what one output kind answers with.

An interpretation that runs converts a value it was given. This one has no value, so what an endpoint answers with has to be read from the kind’s type.

Required Methods§

Source

fn answers(schema: &JsonSchemaShape) -> Vec<OpenApiAnswer>

Describes every answer this kind states, naming the shapes it mentions along the way.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl OpenApiOutputAlg<()> for OpenApiEmptyOutput

Source§

impl<File, Error> OpenApiOutputAlg<(Result<File, Error>, String)> for OpenApiFileOutput
where Error: HttpErrorAlg,

Describes a download: the bytes it answers with, and what reading the file can fail as.

A file handler answers with the file it read and the name to offer it under, so the failure is stated by the file rather than by a .result() around the endpoint. Both halves are described here: the successful body is bytes, and the failure states its own statuses.

Source§

impl<From> OpenApiOutputAlg<From> for OpenApiBytesOutput

Describes the bytes an endpoint answers with, whatever produced them.

What a caller receives is bytes, so the document says so: a shape would describe the value the handler answered with rather than the body it becomes, and a body produced over time has no shape to describe at all.

Source§

impl<From> OpenApiOutputAlg<From> for OpenApiHtmlOutput
where From: ShapeOf<JsonSchemaShape, Shape = JsonSchema>,

Source§

impl<From> OpenApiOutputAlg<From> for OpenApiJsonOutput
where From: ShapeOf<JsonSchemaShape, Shape = JsonSchema>,

Source§

impl<From> OpenApiOutputAlg<From> for OpenApiRedirectOutput

Source§

impl<From> OpenApiOutputAlg<From> for OpenApiStreamOutput

Source§

impl<From> OpenApiOutputAlg<From> for OpenApiTextOutput
where From: ShapeOf<JsonSchemaShape, Shape = JsonSchema>,

Source§

impl<Inner, Error, Value> OpenApiOutputAlg<Result<Value, Error>> for OpenApiResultOutput<Inner, Error>
where Inner: OpenApiOutputAlg<Value>, Error: HttpErrorAlg,

Source§

impl<Inner, From, const CODE: u16> OpenApiOutputAlg<From> for OpenApiStatusOutput<Inner, CODE>
where Inner: OpenApiOutputAlg<From>,

Source§

impl<Inner, Name, Value, Rest> OpenApiOutputAlg<(Value, Rest)> for OpenApiHeaderOutput<Inner, Name>
where Inner: OpenApiOutputAlg<Rest>, Name: HeaderNameAlg,