summary refs log tree commit diff stats
path: root/src/pattern.rs
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2021-01-24 16:16:13 -0300
committerSoniEx2 <endermoneymod@gmail.com>2021-01-24 16:16:13 -0300
commitf2c32a6f27eb67194672f4ae7051714bba2eae85 (patch)
tree56ed50482836fb9e0bc5b2d4375563b303f0d691 /src/pattern.rs
parent5a97e933081cc16a55711421022ba8135564d4a3 (diff)
Clean up public API
Diffstat (limited to 'src/pattern.rs')
-rw-r--r--src/pattern.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pattern.rs b/src/pattern.rs
index 0368a88..2b99163 100644
--- a/src/pattern.rs
+++ b/src/pattern.rs
@@ -1,4 +1,5 @@
 use crate::PatternTypes;
+use crate::RefOwn;
 use crate::errors::PatternError;
 use crate::parser::parse;
 use crate::vm::Matcher;
@@ -10,16 +11,16 @@ pub struct Pattern<T: PatternTypes> {
 }
 
 impl<T: PatternTypes> Pattern<T> {
-    pub fn compile(s: &str) -> Result<Self, PatternError> {
+    pub fn compile(s: &str, defs: Option<()>/*TODO*/) -> Result<Self, PatternError> {
         Ok(Self {
-            consts: parse(s)?
+            consts: parse(s, defs)?
         })
     }
 
     pub fn attempt_match<'a, 'b>(
         &'a self,
-        value: &'b T::Value
+        value: impl Into<RefOwn<'b, T::Ref, T::Own>>
     ) -> Matcher<'a, 'b, T> {
-        Matcher::new(value, &self.consts, self.consts.protos.len() - 1, MAX_CALLS).ok().expect("datafu internal error: MAX_CALLS must not be 0")
+        Matcher::new(value.into(), &self.consts, self.consts.protos.len() - 1, MAX_CALLS).ok().expect("datafu internal error: MAX_CALLS must not be 0")
     }
 }