feat(matcher_rs): add MatchTableBuilder for ergonomic MatchTable construction - #2
Merged
Merged
Conversation
…truction Add a fluent builder API for constructing MatchTable instances without manually building the struct literal. The builder accepts the two required fields (table_id, match_table_type) upfront and provides chainable methods for the rest: - add_word / add_words: single and bulk word append - add_exemption_word / add_exemption_words: exemption variants - exemption_process_type: override exemption ProcessType (defaults to None) - build: consumes the builder and returns the MatchTable Re-export MatchTableBuilder from the crate root. Add 6 tests covering Simple, Regex, Similar match types, bulk helpers, and exemption logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a fluent
MatchTableBuilderthat lets callers construct aMatchTablewithout building the struct literal directly, following the same pattern as the existingSimpleMatcherBuilderandMatcherBuilder.Changes
builder.rs— NewMatchTableBuilder<'a>with:new(table_id, match_table_type)— required fields upfrontadd_word/add_words— single and bulk word appendadd_exemption_word/add_exemption_words— exemption variantsexemption_process_type(ProcessType)— override default (None)build() -> MatchTable<'a>— consumes and returns the tablelib.rs— Re-exportsMatchTableBuilderfrom the crate roottests/test.rs— 6 new tests covering Simple, Regex, Similar types, bulk helpers, and exemption logicTest Results
All 27 tests pass.