pub type FirestoreInstant = Timestamp;Expand description
An exact instant in time, used by this library for Firestore timestamps.
This is an alias for jiff::Timestamp. Prefer this alias over naming
jiff::Timestamp directly, so that your code does not need an explicit
jiff dependency and stays insulated from changes of the underlying
implementation.
Use it for the fields of your structures. To have a field serialized as a
Firestore timestamp, either annotate it with one of the
serialize_as_timestamp attributes, or wrap it in
FirestoreTimestamp, which does the same without an attribute.
§Examples
use firestore::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize)]
struct MyTestStructure {
#[serde(with = "firestore::serialize_as_timestamp")]
created_at: FirestoreInstant,
#[serde(default)]
#[serde(with = "firestore::serialize_as_optional_timestamp")]
updated_at: Option<FirestoreInstant>,
}Aliased Type§
pub struct FirestoreInstant { /* private fields */ }Trait Implementations§
Source§impl From<FirestoreTimestamp> for FirestoreInstant
impl From<FirestoreTimestamp> for FirestoreInstant
Source§fn from(ts: FirestoreTimestamp) -> Self
fn from(ts: FirestoreTimestamp) -> Self
Converts to this type from the input type.