Expand description
Encodings for arguments and results. The serialization/deserialization process for server functions consists of a series of steps, each of which is represented by a different trait:
IntoReq: The client serializes theServerFnargument type into an HTTP request.- The
Clientsends the request to the server. FromReq: The server deserializes the HTTP request back into theServerFntype.- The server calls
ServerFn::run_bodyon the data. IntoRes: The server serializes theServerFn::Outputtype into an HTTP response.- The server integration applies any middleware from
ServerFn::middlewaresand responds to the request. FromRes: The client deserializes the response back into theServerFn::Outputtype.
Rather than a limited number of encodings, this crate allows you to define server functions that
mix and match the input encoding and output encoding. To define a new encoding, you simply implement
an input combination (IntoReq and FromReq) and/or an output encoding (IntoRes and FromRes).
This genuinely is an and/or: while some encodings can be used for both input and output (Json, Cbor, Rkyv),
others can only be used for input (GetUrl, MultipartData).
Structs§
- Bitcode
Encoding - Serializes and deserializes with
bitcode. - Bitcode
Serde Encoding - Serializes and deserializes with
bitcode’sserdeintegration. - Byte
Stream - A stream of bytes.
- Cbor
Encoding - Serializes and deserializes CBOR with
ciborium. - Delete
Url - Pass arguments as the URL-encoded query string of a
DELETErequest. Note: Browser support forDELETErequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - GetUrl
- Pass arguments as a URL-encoded query string of a
GETrequest. - Json
Encoding - Serializes and deserializes JSON with
serde_json. - MsgPack
Encoding - Serializes and deserializes MessagePack with
rmp_serde. - Multipart
Form Data - Encodes multipart form data.
- Patch
- A codec that encodes the data in the patch body
- Patch
Url - Pass arguments as the URL-encoded body of a
PATCHrequest. Note: Browser support forPATCHrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Post
- A codec that encodes the data in the post body
- PostUrl
- Pass arguments as the URL-encoded body of a
POSTrequest. - Postcard
Encoding - A codec for Postcard.
- Put
- A codec that encodes the data in the put body
- PutUrl
- Pass arguments as the URL-encoded body of a
PUTrequest. Note: Browser support forPUTrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Rkyv
Encoding - Pass arguments and receive responses using
rkyvin aPOSTrequest. - Serde
Lite Encoding - Pass arguments and receive responses as JSON in the body of a
POSTrequest. - Streaming
- An encoding that represents a stream of bytes.
- Streaming
Text - An encoding that represents a stream of text.
- Text
Stream - A stream of text.
Enums§
- Multipart
Data - Describes whether the multipart data is on the client side or the server side.
Traits§
- Encoding
- Defines a particular encoding format, which can be used for serializing or deserializing data.
- FromReq
- Deserializes an HTTP request into the data type, on the server.
- FromRes
- Deserializes the data type from an HTTP response.
- IntoReq
- Serializes a data type into an HTTP request, on the client.
- IntoRes
- Serializes the data type into an HTTP response.
Type Aliases§
- Bitcode
- Pass arguments and receive responses using
bitcodein aPOSTrequest. - Bitcode
Serde - Pass arguments and receive responses using
bitcode’s serde integration in aPOSTrequest. - Cbor
- Pass arguments and receive responses using
cborin aPOSTrequest. - Json
- Pass arguments and receive responses as JSON in the body of a
POSTrequest. - MsgPack
- Pass arguments and receive responses as MessagePack in a
POSTrequest. - Patch
Bitcode - Pass arguments and receive responses using
bitcodein the body of aPATCHrequest. Note: Browser support forPATCHrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Patch
Bitcode Serde - Pass arguments and receive responses using
bitcode’s serde integration in the body of aPATCHrequest. Note: Browser support forPATCHrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Patch
Cbor - Pass arguments and receive responses using
cborin the body of aPATCHrequest. Note: Browser support forPATCHrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Patch
Json - Pass arguments and receive responses as JSON in the body of a
PATCHrequest. Note: Browser support forPATCHrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Patch
MsgPack - Pass arguments and receive responses as MessagePack in the body of a
PATCHrequest. Note: Browser support forPATCHrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Patch
Postcard - Pass arguments and receive responses with postcard in a
PATCHrequest. Note: Browser support forPATCHrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Patch
Rkyv - Pass arguments and receive responses as
rkyvin aPATCHrequest. Note: Browser support forPATCHrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Patch
Serde Lite - Pass arguments and receive responses as JSON in the body of a
PATCHrequest. Note: Browser support forPATCHrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Postcard
- Pass arguments and receive responses with postcard in a
POSTrequest. - PutBitcode
- Pass arguments and receive responses using
bitcodein the body of aPUTrequest. Note: Browser support forPUTrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - PutBitcode
Serde - Pass arguments and receive responses using
bitcode’s serde integration in the body of aPUTrequest. Note: Browser support forPUTrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - PutCbor
- Pass arguments and receive responses using
cborin the body of aPUTrequest. Note: Browser support forPUTrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - PutJson
- Pass arguments and receive responses as JSON in the body of a
PUTrequest. Note: Browser support forPUTrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - PutMsg
Pack - Pass arguments and receive responses as MessagePack in the body of a
PUTrequest. Note: Browser support forPUTrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - PutPostcard
- Pass arguments and receive responses with postcard in a
PUTrequest. Note: Browser support forPUTrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - PutRkyv
- Pass arguments and receive responses as
rkyvin aPUTrequest. Note: Browser support forPUTrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - PutSerde
Lite - Pass arguments and receive responses as JSON in the body of a
PUTrequest. Note: Browser support forPUTrequests without JS/WASM may be poor. Consider using aPOSTrequest if functionality without JS/WASM is required. - Rkyv
- Pass arguments and receive responses as
rkyvin aPOSTrequest. - Serde
Lite - Pass arguments and receive responses as JSON in the body of a
POSTrequest.