pub struct Data<T>(pub T);Expand description
An Extractor that returns the deserialized data without checking errors.
If a deserialization error occurs, the handler won’t be called
and an error log will be printed if the tracing feature is enabled.
§Deserializing to a generic type (e.g. Data<serde_json::Value>).
Deserialization to a generic type is possible (note that it will be less performant/memory efficient).
However if you have binary data in you message. It is recommended to use rmpv::Value
rather than serde_json::Value. This is because rmpv::Value has a binary data variant contrary
to serde_json::Value. If you still use serde_json::Value with binary data,
it will be converted to a sequence of numbers which is less efficient than a binary blob.
Alternatively if your binary fields are at the top level of your object you can deserialize to a type
with a dynamic type in it: (serde_json::Value, Bytes, Bytes) or
struct MyData {
data: serde_json::Value,
binary1: bytes::Bytes,
binary2: bytes::Bytes,
}Tuple Fields§
§0: T