pub type Compact<T> = MsgPack<T, true>;Available on crate feature
msgpack only.Expand description
Serializes responses in a compact MesagePack format, where structs are serialized as arrays of their field values.
To respond with compact MessagePack data, return a Compact<T> type,
where T implements Serialize from serde. The content type of the
response is set to application/msgpack automatically.
use rocket::serde::msgpack;
#[get("/users/<id>")]
fn user(id: usize) -> msgpack::Compact<User> {
let user_from_id = User::from(id);
/* ... */
msgpack::MsgPack(user_from_id)
}Prefer using MsgPack<T> for request guards, as the named/compact
distinction is not relevant for request data - the correct option is
implemented automatically. Using Compact<T> as a request guard will
NOT prevent named requests from being accepted.
Aliased Type§
pub struct Compact<T>(pub T);Tuple Fields§
§0: T