diff options
Diffstat (limited to 'src/pattern.rs')
-rw-r--r-- | src/pattern.rs | 11 |
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") } } |