From d26db33422b720822b9b24b99ddadc3ffd36d752 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Wed, 13 Jan 2021 11:20:21 -0300 Subject: Finalize Holder design (hopefully) --- src/pattern.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/pattern.rs') 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 { - constants: PatternConstants, + consts: PatternConstants, } impl Pattern { pub fn compile(s: &str) -> Result { 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") } } -- cgit 1.4.1