From d849f5e301fa47cfd87df1e7f1ad0346ddf387f1 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Sat, 8 Apr 2023 18:52:00 -0300 Subject: Initial success --- src/pattern.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/pattern.rs') 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 { impl Pattern { /// Matches the pattern against an input. - pub fn deserialize<'de, Der, De>(&self, der: Der) -> Result + pub fn deserialize<'de, Der>( + &self, + der: Der, + ) -> Result, Der::Error> where Der: Deserializer<'de>, - De: Deserialize<'de>, { let mut err = Default::default(); let mut frames = Default::default(); @@ -57,9 +60,8 @@ impl Pattern { // 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)) } } -- cgit 1.4.1