summary refs log tree commit diff stats
path: root/src/pattern.rs
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2021-01-13 11:20:21 -0300
committerSoniEx2 <endermoneymod@gmail.com>2021-01-13 11:20:21 -0300
commitd26db33422b720822b9b24b99ddadc3ffd36d752 (patch)
tree4e43c3bfb1a20f7c8828bdf5c7bcd9b87c81729c /src/pattern.rs
parentbcdba3431c72cd0804d9a95972a907b828fb5fad (diff)
Finalize Holder design (hopefully)
Diffstat (limited to 'src/pattern.rs')
-rw-r--r--src/pattern.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/pattern.rs b/src/pattern.rs
index 8c57f00..0368a88 100644
--- a/src/pattern.rs
+++ b/src/pattern.rs
@@ -6,17 +6,20 @@ use crate::vm::PatternConstants;
 use crate::vm::MAX_CALLS;
 
 pub struct Pattern<T: PatternTypes> {
-    constants: PatternConstants<T>,
+    consts: PatternConstants<T>,
 }
 
 impl<T: PatternTypes> Pattern<T> {
     pub fn compile(s: &str) -> Result<Self, PatternError> {
         Ok(Self {
-            constants: parse(s)?
+            consts: parse(s)?
         })
     }
 
-    pub fn attempt_match<'a, 'b>(&'a self, value: &'b T::Value) -> Matcher<'a, 'b, T> {
-        Matcher::new(value, &self.constants, self.constants.protos.len() - 1, MAX_CALLS).ok().expect("datafu internal error: MAX_CALLS must not be 0")
+    pub fn attempt_match<'a, 'b>(
+        &'a self,
+        value: &'b T::Value
+    ) -> 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")
     }
 }