Crate rocket_contrib[][src]

This crate contains officially sanctioned contributor libraries that provide functionality commonly used by Rocket applications.

These libraries are always kept in-sync with the core Rocket library. They provide common, but not fundamental, abstractions to be used by Rocket applications. In particular, contributor libraries typically export types implementing a combination of the FromRequest, FromParam, and Responder traits.

Each module in this library is held behind a feature flag, with the most common modules exposed by default. The present feature list is below, with an asterisk next to the features that are enabled by default:

The recommend way to include features from this crate via Cargo in your project is by adding a [dependencies.rocket_contrib] section to your Cargo.toml file, setting default-features to false, and specifying features manually. For example, to use the JSON module, you would add:

[dependencies.rocket_contrib]
version = "*"
default-features = false
features = ["json"]

This crate is expected to grow with time, bringing in outside crates to be officially supported by Rocket.

Re-exports

pub use serde_json::json_internal;

Macros

json

A macro to create ad-hoc JSON serializable values using JSON syntax.

Structs

Json

The JSON type: implements FromData and Responder, allowing you to easily consume and respond with JSON.

MsgPack

The MsgPack type: implements FromData and Responder, allowing you to easily consume and respond with MessagePack data.

SerdeError

This type represents all possible errors that can occur when serializing or deserializing JSON data.

Template

The Template type implements generic support for template rendering in Rocket.

UUID

Implements FromParam and FormFormValue for accepting UUID values from the uuid crate.

Enums

MsgPackError

Enum representing errors that can occur while decoding MessagePack data.

UuidParseError

Error details for string parsing failures.

Value

Represents any valid JSON value.