Skip to content

Commit

Permalink
Get rid of the boxed iterator returned from query in favor of impl It…
Browse files Browse the repository at this point in the history
…erator
  • Loading branch information
tgecho committed Oct 16, 2023
1 parent acedb4f commit a8d21d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions canrun/src/core/query.rs
Expand Up @@ -57,11 +57,11 @@ pub trait Query<'a> {
assert_eq!(result, vec![1])
```
*/
fn query<Q: Reify + 'a>(self, query: Q) -> Box<dyn Iterator<Item = Q::Reified> + 'a>;
fn query<Q: Reify + 'a>(self, query: Q) -> impl Iterator<Item = Q::Reified>;
}

impl<'a, S: StateIterator + 'a> Query<'a> for S {
fn query<Q: Reify + 'a>(self, query: Q) -> Box<dyn Iterator<Item = Q::Reified> + 'a> {
fn query<Q: Reify + 'a>(self, query: Q) -> impl Iterator<Item = Q::Reified> {
Box::new(
self.into_states()
.filter_map(move |s| query.reify_in(&s.ready()?)),
Expand Down

0 comments on commit a8d21d9

Please sign in to comment.