Closed Txuritan closed 1 year ago
That is very cool. Unfortunately we will not be able to use it from python because you can’t return anything with a lifetime. But probably something interesting to explore for the rust side!
My initial idea for that was to somehow Box
the Iterator
and create a custom PyO3 class to act as the Iterator
, like a generator/yield. But that might not be possible due to just how many lifetimes are required to avoid cloning data.
I think they will eventually be converted to the following types in most scenarios.
(&'a str, &'b str)
=> (String, String)
(&'a str, &'b str)
=> (Arc<str>, Arc<str>)
Originally posted by @adriangb in https://github.com/viz-rs/path-tree/issues/22#issuecomment-1256553651
As mentioned a
Iterator
variant ofPath::params
might be useful. So I had a go at it and managed to get a version working using a customIterator
type. The downside is that it requires a brittle typediterator
chain.Would like some feedback on this as it would be quite useful to remove the ending allocation but its quite verbose and may be hard to use.