Struct seamless::handler::body::FromJson[][src]

pub struct FromJson<T: ApiBody>(pub T);
Expand description

If the last argument to a handler is this, we’ll assume that the user needs to provide JSON that decodes to T. Notably, T needs to implement ApiBody with the Deserialize option.

Tuple Fields

0: T

Trait Implementations

This returns information about the shape of the type and description of parts of it.

Serialize the type to JSON.

Serialize the type to a serde_json::Value.

Deserialize from bytes containing a JSON value.

Deserialize from a serde_json::Value.

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Given a request containing arbitrary bytes, this function needs to return an instance of the type that this trait is implemented on (typically by deserializing it from the bytes provided), or else it should return an error describing what went wrong. Read more

Which HTTP method is required for this Body to be valid. By default, if a body is present in the handler we’ll expect the method to be POST. Implement this function to override that. Read more

The body type that will be extracted. Whatever we extract should itself implement ApiBody to correspond to the generated type information. Read more

Extract the body of the request with this, unwrapping as many layers of nesting as needed. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.