| Crates.io | gat-lending-iterator |
| lib.rs | gat-lending-iterator |
| version | 0.1.6 |
| created_at | 2023-08-15 14:50:28.707731+00 |
| updated_at | 2024-09-14 21:48:52.644813+00 |
| description | A library for iterators who's items can [mutably] reference the iterator. |
| homepage | https://github.com/Crazytieguy/gat-lending-iterator |
| repository | https://github.com/Crazytieguy/gat-lending-iterator/ |
| max_upload_size | |
| id | 945093 |
| size | 52,001 |
My concept for what a lending iterator crate should look like. Work in progress.
Most Iterator methods can work as is on LendingIterators, but some wouldn't make sense. Basically any method that needs to look at more than one element at once isn't possible.
Some LendingIterator methods may return something that can act as an Iterator. For example cloned, or map, when the function passed to it returns a value that isn't tied to the lifetime of its input. In these cases, my design choice was to conditionally implement IntoIterator for the adapter.
I've also included an extension trait ToLendingIterator: IntoIterator for iterators that allows turning them into lending iterators in various ways, for example over windows of elements. It's possible I will add more methods to this trait.
LendingIterators as they do on IteratorsLendingIteratorsLendingIteratorsLendingIterator into an Iterator