1use crate::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.
6pub struct InPlaceSeed<'a, T: 'a>(pub &'a mut T);
7
8impl<'a, 'de, T> DeserializeSeed<'de> for InPlaceSeed<'a, T>
9where
10 T: Deserialize<'de>,
11{
12 type Value = ();
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