Skip to content

feat: add map combinator for input projection#214

Closed
leno23 wants to merge 1 commit into
assert-rs:masterfrom
leno23:feat/map-combinator-142
Closed

feat: add map combinator for input projection#214
leno23 wants to merge 1 commit into
assert-rs:masterfrom
leno23:feat/map-combinator-142

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

Adds MapPredicate and PredicateMapExt::map to adapt a predicate on one type (e.g. TaskId) for use on a larger type (e.g. Task) by mapping the input before evaluation.

Addresses the use case from #142:

let has_id = predicate::in_hash(ids).map(|task: &Task| task.id);
predicate::always().boxed().and(has_id.not()).boxed();

Test plan

  • cargo test (unit + doctests)
  • map_in_hash and map_combines_with_boxed regression tests

Fixes #142

Made with Cursor

Add MapPredicate and PredicateMapExt::map so predicates on a field type
(e.g. TaskId) can be reused when filtering a larger type (e.g. Task),
including in boxed boolean combinations (assert-rs#142).
@leno23 leno23 force-pushed the feat/map-combinator-142 branch from a1da9ae to be5e16c Compare May 17, 2026 14:28
@epage
Copy link
Copy Markdown
Contributor

epage commented May 18, 2026

This was in a "handling of feedback" mode.

@epage epage closed this May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add map combinator to map input values to a predicate

2 participants