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§
- A Deserializer type which implements
serde::DeserializerforValue. - Represents all possible errors that can occur when serializing or deserializing a Firestore Value.
- LatLng
- Reference
- A Serializer type which implements
serde::SerializerforValue. - Timestamp
Functions§
- Deserialize an instance of type
Tfrom a Firestore Value. - Serialize an instance of type
Tto a Firestore Value.
Type Aliases§
- A specialized
Resulttype for this crate.