bytelines
bytelines copied to clipboard
Implements Lender for bytelines
This PR makes bytelines implement the LendingIterator trait from https://github.com/vigna/hrtb-lending-iterator-rs. The changes are minimal, but now standard iterator operations such as Map, Take, etc. are available. There's just a few methods, but we're working on expanding what is available. Our goal is to make everything that makes sense for a lending iterator available.
Oops. We discovered the Lender crate which is actually much more developed than ours. So I changed the PR into adding Lender support.
Hi @vigna!
I'm not against this, except that it adds a dependency I'm unfamiliar with for (what I perceive to be) little gain? Although it would be a little more efficient than into_iter() which would currently be used for this. I'm also a little concerned by this from the Lender README:
This crate was not made to be used in any sort of production code, so please, use it at your own risk (Documentation be damned! Unsafe transmutes beware!).
With this in mind, do you think inclusion is worth it? We could always hide behind a feature flag.
Well, if you consider having all Iterator functions (map, etc.) a little gain I don't think I can convince you otherwise. Lance is a bit whimsical in his documentation, but the crate is very solid and we use it in production every day. And yes, if you prefer I can but it behind a feature.
Well, if you consider having all Iterator functions (map, etc.) a little gain I don't think I can convince you otherwise.
I think you misunderstood. I mean that adding Lender in your own crate is fewer than 10 lines, so including it as an additional maintenance cost inside this library likely isn't worth the trade off. It would be a little different if this was some de-facto library, but it's rather small with only ~1k downloads so I'm not sure if there's a demand.
No, you can't because of the orphan rule.