Skip to content

Commit

Permalink
Small internal refactorings and capacity allocation improvement (#99)
Browse files Browse the repository at this point in the history
* Fixed name of Ref serializer

* Firestore serializer capacity fixed
  • Loading branch information
abdolence authored May 29, 2023
1 parent 7fe9526 commit 5c80226
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/firestore_serde/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ where
for<'de> T: Deserialize<'de>,
{
let mut fields: HashMap<String, gcloud_sdk::google::firestore::v1::Value> =
HashMap::with_capacity(document.fields.len());
HashMap::with_capacity(document.fields.len() + 4);

for (k, v) in document.fields.iter() {
fields.insert(k.to_owned(), v.to_owned());
Expand Down
6 changes: 3 additions & 3 deletions src/firestore_serde/reference_serializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pub fn serialize_reference_for_firestore<T: ?Sized + Serialize>(
value: &T,
none_as_null: bool,
) -> Result<FirestoreValue, FirestoreError> {
struct TimestampSerializer {
struct ReferenceSerializer {
none_as_null: bool,
}

impl Serializer for TimestampSerializer {
impl Serializer for ReferenceSerializer {
type Ok = FirestoreValue;
type Error = FirestoreError;
type SerializeSeq = crate::firestore_serde::serializer::SerializeVec;
Expand Down Expand Up @@ -306,5 +306,5 @@ pub fn serialize_reference_for_firestore<T: ?Sized + Serialize>(
}
}

value.serialize(TimestampSerializer { none_as_null })
value.serialize(ReferenceSerializer { none_as_null })
}

0 comments on commit 5c80226

Please sign in to comment.