Skip to content

Commit

Permalink
fix RID deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Waridley committed Jun 9, 2021
1 parent 2ab55c6 commit beea410
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gdnative-core/src/core_types/rid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl PartialOrd for Rid {
#[cfg(feature = "serde")]
mod serde {
use super::*;
use ::serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer};
use ::serde::{de::{Visitor, Error}, Deserialize, Deserializer, Serialize, Serializer};
use std::fmt::Formatter;

impl Serialize for Rid {
Expand All @@ -114,6 +114,13 @@ mod serde {
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
formatter.write_str("Unit as an RID placeholder")
}

fn visit_unit<E>(self) -> Result<Self::Value, E>
where
E: Error,
{
Ok(Rid::new())
}
}
deserializer.deserialize_unit(RidVisitor)?;
Ok(Rid::new())
Expand Down

0 comments on commit beea410

Please sign in to comment.