summary refs log tree commit diff stats
path: root/src/pattern.rs
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2023-04-08 18:52:00 -0300
committerSoniEx2 <endermoneymod@gmail.com>2023-04-08 18:52:00 -0300
commitd849f5e301fa47cfd87df1e7f1ad0346ddf387f1 (patch)
treea2480d05b753d94a6a8afee9832a902edf02d266 /src/pattern.rs
parent6dd30531ac62f6a3a564b7341d43f6cd71b90794 (diff)
Initial success
Diffstat (limited to 'src/pattern.rs')
-rw-r--r--src/pattern.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/pattern.rs b/src/pattern.rs
index 6286ff9..38cdcda 100644
--- a/src/pattern.rs
+++ b/src/pattern.rs
@@ -13,6 +13,7 @@ use serde::ser::Serialize;
 
 use crate::Predicate;
 use crate::errors::PatternError;
+use crate::graph::Graph;
 use crate::parser::parse;
 use crate::vm;
 use crate::vm::PatternConstants;
@@ -36,10 +37,12 @@ pub struct Pattern<O: Serialize> {
 
 impl<O: Serialize> Pattern<O> {
     /// Matches the pattern against an input.
-    pub fn deserialize<'de, Der, De>(&self, der: Der) -> Result<De, Der::Error>
+    pub fn deserialize<'de, Der>(
+        &self,
+        der: Der,
+    ) -> Result<Graph<'_, 'de>, Der::Error>
     where
         Der: Deserializer<'de>,
-        De: Deserialize<'de>,
     {
         let mut err = Default::default();
         let mut frames = Default::default();
@@ -57,9 +60,8 @@ impl<O: Serialize> Pattern<O> {
         // this should always be None
         debug_assert!(obj.is_none());
         debug_assert!(packs.len() <= 1);
-        let pack = packs.pop().unwrap_or_else(Default::default);
-        let de = De::deserialize(vm::Unpacker::new(pack, MAX_CALLS));
-        todo!()
+        let pack = packs.pop();
+        Ok(Graph(pack))
     }
 }