I am not good at English. Sorry if there are any funny expressions.
I am currently thinking about the LendingIterator
, which is often introduced as an example of GAT. It is similar in usage to a normal iterator, except that the item's lifetime is tied to the iterator.
Therefore, I thought the APIs around the LendingIterator
should be similar to those of the normal iterators.
However, when I thought about IntoLendingIterator
, that corresponds to IntoIterator
for Iterator
, I realized that it could not be similar. IntoIterator
has two associated types Item
and IntoIter
. If I try to have corresponding two associated types in IntoLendingIterator
, I can't describe the lifetime relationship between them well.
Thus, I searched crates.io to see how others implemented such features in LendingIterator
. Then I found that most of crates support such features in process of converting from Iterator
to LendingIterator
. However, I could not find any crate that took the approach I had in mind (ex: gat-lending-iterator, lending-iterator, lender).
Where did I go wrong...?
- In the first place, my approach is not good?
- My approach is good, but it can't?
- My approach can be achieved in some way?