-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Labels
enhancementImprove the expectedImprove the expected
Description
EqPredicate
stores T
and its eval
takes a &T
. But what about Vec
/slice
, String
/str
, and PathBuf
/path
?
Exploration Summary
After making Predicate
use generics rather than associated types (see #29)
Dead ends
Predicate { eval<I: AsRef<Item>>(&self, item: I) }
: not object-safe which means we can'tBox<Predicate>
or&Predicate
.Predicate { eval(&self, item: Item) }
(ieItem=&str
rather thanItem=str
): violates borrow checker in boolean predicates- Above with
Item: Copy
: Lifetime issues (branch) impl Predicate<AsRef<T>> for EqPredicate<T>
: No AsRef implemented for numeric typesimpl Predicate<Borrow<T>> for EqPredicate<T>
:Sized
issues (branch)
Options:
- Create an
AsRef
adapter
Metadata
Metadata
Assignees
Labels
enhancementImprove the expectedImprove the expected