1 use de::{Deserialize, DeserializeSeed, Deserializer};
2 
3 /// A DeserializeSeed helper for implementing deserialize_in_place Visitors.
4 ///
5 /// Wraps a mutable reference and calls deserialize_in_place on it.
6 pub struct InPlaceSeed<'a, T: 'a>(pub &'a mut T);
7 
8 impl<'a, 'de, T> DeserializeSeed<'de> for InPlaceSeed<'a, T>
9 where
10     T: Deserialize<'de>,
11 {
12     type Value = ();
deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error> where D: Deserializer<'de>,13     fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
14     where
15         D: Deserializer<'de>,
16     {
17         T::deserialize_in_place(deserializer, self.0)
18     }
19 }
20