Struct seamless::handler::body::FromJson

source ·
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.
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.
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.
The body type that will be extracted. Whatever we extract should itself implement ApiBody to correspond to the generated type information.
Extract the body of the request with this, unwrapping as many layers of nesting as needed.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.