Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement PredicateBoxExt for ?Sized Items #180

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: Implement PredicateBoxExt for ?Sized
In particular, this makes `predicate::str::contains(...).boxed()` work.
marienz committed Dec 19, 2024

Verified

This commit was signed with the committer’s verified signature.
commit 7cd735b9ed1e43168fc9cbeceafa065c8327ce39
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
<!-- next-header -->
## [Unreleased] - ReleaseDate

### Added

- The `boxed` function is now available for predicates with an `Item` type that
is not `Sized`.

## [3.1.2] - 2024-07-25

## [3.1.1] - 2024-07-25
13 changes: 12 additions & 1 deletion src/boxed.rs
Original file line number Diff line number Diff line change
@@ -114,4 +114,15 @@ where
}
}

impl<P, Item> PredicateBoxExt<Item> for P where P: Predicate<Item> {}
impl<P, Item: ?Sized> PredicateBoxExt<Item> for P where P: Predicate<Item> {}

#[cfg(test)]
mod test {
use crate::prelude::*;

#[test]
fn unsized_boxed() {
epage marked this conversation as resolved.
Show resolved Hide resolved
let p = predicate::always().boxed();
p.eval("4");
}
}