We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d197e2 commit d9ab038Copy full SHA for d9ab038
src/value/tape.rs
@@ -33,6 +33,24 @@ impl<'input> Tape<'input> {
33
// so we can safely change the lifetime of the tape to 'new
34
unsafe { std::mem::transmute(self) }
35
}
36
+
37
+ /// Deserializes the tape into a type that implements `serde::Deserialize`
38
+ /// # Errors
39
+ /// Returns an error if the deserialization fails
40
+ #[cfg(feature = "serde")]
41
+ pub fn deserialize<T>(self) -> crate::Result<T>
42
+ where
43
+ T: serde::Deserialize<'input>,
44
+ {
45
+ use crate::Deserializer;
46
47
+ let mut deserializer = Deserializer {
48
+ tape: self.0,
49
+ idx: 0,
50
+ };
51
52
+ T::deserialize(&mut deserializer)
53
+ }
54
55
56
/// Wrapper around the tape that allows interaction via a `Value`-like API.
0 commit comments