Crate serde_firestore_value
source ·Expand description
A serde (de)serializer using Firestore Value as its data format.
use google_api_proto::google::firestore::v1::{value::ValueType, Value};
use serde_firestore_value::{from_value, to_value};
fn main() -> anyhow::Result<()> {
let t = 1_i64; // T: Serialize
let s = to_value(&t)?;
assert_eq!(s, Value {
value_type: Some(ValueType::IntegerValue(1_i64))
});
let d = from_value::<'_, i64>(&s)?;
assert_eq!(d, t);
Ok(())
}Modules
- Modules specified in
#[serde(with = "...")]to support special values such as GeoPoint, Reference, and Timestamp.
Structs
- Represents all possible errors that can occur when serializing or deserializing a Firestore Value.
Functions
- Deserialize an instance of type
Tfrom a Firestore Value. - Serialize an instance of type
Tto a Firestore Value.