pub trait FirestoreDataConverter:
Send
+ Sync
+ Clone
+ 'static {
type Model: Clone;
// Required methods
fn to_map(
&self,
value: &Self::Model,
) -> FirestoreResult<BTreeMap<String, FirestoreValue>>;
fn from_map(&self, value: &MapValue) -> FirestoreResult<Self::Model>;
}Expand description
Trait describing how to convert between user models and Firestore maps.
This mirrors the modular JS FirestoreDataConverter contract: writes use
to_map, reads use from_map, and callers choose the Model type they
want to surface.
Required Associated Types§
Required Methods§
Sourcefn to_map(
&self,
value: &Self::Model,
) -> FirestoreResult<BTreeMap<String, FirestoreValue>>
fn to_map( &self, value: &Self::Model, ) -> FirestoreResult<BTreeMap<String, FirestoreValue>>
Encodes the user model into a Firestore map for writes.
Sourcefn from_map(&self, value: &MapValue) -> FirestoreResult<Self::Model>
fn from_map(&self, value: &MapValue) -> FirestoreResult<Self::Model>
Decodes a Firestore map into the user model for reads.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.