pub trait ObjectSerialize {
    fn from_str(obj: &str) -> Result<Self, ObjectError>
    where
        Self: Sized
; fn into_serialized_object(self) -> Result<JsonValue, ObjectError>; }
Expand description

An object that can be serialized into JSON.

Objects are defined by their structure in the metrics definition.

This is essentially a wrapper around serde’s Serialize/Deserialize, but in a way we can name it for our JSON (de)serialization.

Required Methods§

Deserialize the object from its JSON representation.

Returns an error if deserialization fails. This should not happen for glean_parser-generated and later serialized objects.

Serialize this object into a JSON string.

Implementors§