pub trait ObjectSerialize {
    // Required methods
    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§

source

fn from_str(obj: &str) -> Result<Self, ObjectError>
where Self: Sized,

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.

source

fn into_serialized_object(self) -> Result<JsonValue, ObjectError>

Serialize this object into a JSON string.

Implementors§

source§

impl<V> ObjectSerialize for V
where V: Serialize + for<'de> Deserialize<'de>,