-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
The problem with the Iterator
trait is the type of Item
. It has to be owned and cannot have a lifetime based on the &mut self
item. This means that it cannot return the chain as an item.
The problem is that the result is owned. Here we want item1
to be usable, but chain
be moved/unusable etc?
let mut iterator = json_iterator(r#"{ "key1": 2, "key2": "example" } "#);
let (chain, item1) = iterator.next();
let (chain, item2) = iterator.next();
However could experiment with Rc<>
and unsafe
to see if something is possible here.
The other possibility is referencing a field on the iterator.
let mut iterator = json_iterator(r#"{ "key1": 2, "key2": "example" } "#);
let item1 = iterator.next();
let chain = iterator.chain();
let item2 = iterator.next();
let chain = iterator.chain();
So far the callback based design is fine. But if someone wants this I can investigate these options
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed