Skip to content

feat: implement PredicateBoxExt for ?Sized Items#180

Merged
epage merged 1 commit intoassert-rs:masterfrom
marienz:master
Dec 19, 2024
Merged

feat: implement PredicateBoxExt for ?Sized Items#180
epage merged 1 commit intoassert-rs:masterfrom
marienz:master

Conversation

@marienz
Copy link
Copy Markdown
Contributor

@marienz marienz commented Dec 17, 2024

This looks like an oversight: the trait itself already had Item: ?Sized but the generic impl did not.

I noticed this while trying to chain together a variable number of predicate::str::contains(...) with and(). Calling predicates::BoxPredicate::new() explicitly works, but is much wordier than .boxed(), which fails:

173 | pub struct ContainsPredicate {
    | ---------------------------- doesn't satisfy `_: PredicateBoxExt<str>`
    |
    = note: the following trait bounds were not satisfied:
            `str: Sized`
            which is required by `ContainsPredicate: predicates::PredicateBoxExt<str>`
            `&ContainsPredicate: Predicate<_>`
            which is required by `&ContainsPredicate: predicates::PredicateBoxExt<_>`
            `&mut ContainsPredicate: Predicate<_>`
            which is required by `&mut ContainsPredicate: predicates::PredicateBoxExt<_>`

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 17, 2024

Pull Request Test Coverage Report for Build 12410765220

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.7%) to 7.376%

Totals Coverage Status
Change from base Build 12124300894: 0.7%
Covered Lines: 52
Relevant Lines: 705

💛 - Coveralls

@marienz
Copy link
Copy Markdown
Contributor Author

marienz commented Dec 18, 2024

(I've force-pushed this to fix the capitalization in the commit messages pointed out by the commits lint. Code should not have changed.)

In particular, this makes `predicate::str::contains(...).boxed()` work.
@epage epage merged commit 6db4ca3 into assert-rs:master Dec 19, 2024
takumi-earth pushed a commit to earthlings-dev/predicates-rs that referenced this pull request Jan 27, 2026
feat: implement `PredicateBoxExt` for `?Sized` `Item`s
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.

3 participants