Skip to content

Commit 7cd735b

Browse files
committed
feat: Implement PredicateBoxExt for ?Sized
In particular, this makes `predicate::str::contains(...).boxed()` work.
1 parent 5bd6da7 commit 7cd735b

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
<!-- next-header -->
88
## [Unreleased] - ReleaseDate
99

10+
### Added
11+
12+
- The `boxed` function is now available for predicates with an `Item` type that
13+
is not `Sized`.
14+
1015
## [3.1.2] - 2024-07-25
1116

1217
## [3.1.1] - 2024-07-25

src/boxed.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,15 @@ where
114114
}
115115
}
116116

117-
impl<P, Item> PredicateBoxExt<Item> for P where P: Predicate<Item> {}
117+
impl<P, Item: ?Sized> PredicateBoxExt<Item> for P where P: Predicate<Item> {}
118+
119+
#[cfg(test)]
120+
mod test {
121+
use crate::prelude::*;
122+
123+
#[test]
124+
fn unsized_boxed() {
125+
let p = predicate::always().boxed();
126+
p.eval("4");
127+
}
128+
}

0 commit comments

Comments
 (0)