Skip to content

Commit 59b5384

Browse files
committed
VariantDispatch passing all serde tests; remove Variant impls for now
still needs cleanup
1 parent 95e1ab0 commit 59b5384

File tree

5 files changed

+988
-953
lines changed

5 files changed

+988
-953
lines changed

gdnative-core/src/core_types/dictionary.rs

+57-57
Original file line numberDiff line numberDiff line change
@@ -577,63 +577,63 @@ where
577577
}
578578
}
579579

580-
#[cfg(feature = "serde")]
581-
pub(super) mod serde {
582-
use super::*;
583-
use ::serde::{
584-
de::{MapAccess, Visitor},
585-
ser::SerializeMap,
586-
Deserialize, Deserializer, Serialize, Serializer,
587-
};
588-
use std::fmt::Formatter;
589-
590-
impl Serialize for Dictionary {
591-
#[inline]
592-
fn serialize<S>(&self, ser: S) -> Result<S::Ok, S::Error>
593-
where
594-
S: Serializer,
595-
{
596-
let mut ser = ser.serialize_map(Some(self.len() as usize))?;
597-
for (key, value) in self.iter() {
598-
ser.serialize_entry(&key, &value)?
599-
}
600-
ser.end()
601-
}
602-
}
603-
604-
pub(in super::super) struct DictionaryVisitor;
605-
606-
impl<'de> Visitor<'de> for DictionaryVisitor {
607-
type Value = Dictionary<Unique>;
608-
609-
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
610-
formatter.write_str("a Dictionary")
611-
}
612-
613-
fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
614-
where
615-
A: MapAccess<'de>,
616-
{
617-
let dict = Dictionary::new();
618-
while let Some((key, value)) = map.next_entry::<Variant, Variant>()? {
619-
dict.insert(key, value)
620-
}
621-
Ok(dict)
622-
}
623-
}
624-
625-
impl<'de, Access: ThreadAccess> Deserialize<'de> for Dictionary<Access> {
626-
#[inline]
627-
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
628-
where
629-
D: Deserializer<'de>,
630-
{
631-
deserializer
632-
.deserialize_map(DictionaryVisitor)
633-
.map(|dict| unsafe { dict.cast_access() })
634-
}
635-
}
636-
}
580+
// #[cfg(feature = "serde")]
581+
// pub(super) mod serde {
582+
// use super::*;
583+
// use ::serde::{
584+
// de::{MapAccess, Visitor},
585+
// ser::SerializeMap,
586+
// Deserialize, Deserializer, Serialize, Serializer,
587+
// };
588+
// use std::fmt::Formatter;
589+
//
590+
// impl Serialize for Dictionary {
591+
// #[inline]
592+
// fn serialize<S>(&self, ser: S) -> Result<S::Ok, S::Error>
593+
// where
594+
// S: Serializer,
595+
// {
596+
// let mut ser = ser.serialize_map(Some(self.len() as usize))?;
597+
// for (key, value) in self.iter() {
598+
// ser.serialize_entry(&key, &value)?
599+
// }
600+
// ser.end()
601+
// }
602+
// }
603+
//
604+
// pub(in super::super) struct DictionaryVisitor;
605+
//
606+
// impl<'de> Visitor<'de> for DictionaryVisitor {
607+
// type Value = Dictionary<Unique>;
608+
//
609+
// fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
610+
// formatter.write_str("a Dictionary")
611+
// }
612+
//
613+
// fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
614+
// where
615+
// A: MapAccess<'de>,
616+
// {
617+
// let dict = Dictionary::new();
618+
// while let Some((key, value)) = map.next_entry::<Variant, Variant>()? {
619+
// dict.insert(key, value)
620+
// }
621+
// Ok(dict)
622+
// }
623+
// }
624+
//
625+
// impl<'de, Access: ThreadAccess> Deserialize<'de> for Dictionary<Access> {
626+
// #[inline]
627+
// fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
628+
// where
629+
// D: Deserializer<'de>,
630+
// {
631+
// deserializer
632+
// .deserialize_map(DictionaryVisitor)
633+
// .map(|dict| unsafe { dict.cast_access() })
634+
// }
635+
// }
636+
// }
637637

638638
godot_test!(test_dictionary {
639639
use std::collections::HashSet;

0 commit comments

Comments
 (0)