Add search iterator #1

Merged
wathiede merged 1 commits from ggriffiniii/photosync:master into master 2020-02-09 08:59:14 -08:00
Contributor
No description provided.
wathiede reviewed 2020-02-07 19:40:07 -08:00
src/main.rs Outdated
@ -100,0 +91,4 @@
if let Some(v) = self.items.next() {
return Some(Ok(v));
}
if self.finished {
Owner

I'm surprised there isn't a way to implement this using self.req.page_token.is_none(), why keep the extra state in finished? You have to structure it a little different to deal with the first time through next(), but it should be doable, rgiht?

I'm surprised there isn't a way to implement this using `self.req.page_token.is_none()`, why keep the extra state in `finished`? You have to structure it a little different to deal with the first time through `next()`, but it should be doable, rgiht?
Author
Contributor

I couldn't think of a way to structure it differently. You need some state machine to differentiate between the first iteration and last since page token will be none in both cases. It seemed like the simplest additional state was just the bool but I would be happy to hear something better.

I couldn't think of a way to structure it differently. You need some state machine to differentiate between the first iteration and last since page token will be none in both cases. It seemed like the simplest additional state was just the bool but I would be happy to hear something better.
Owner

Ok, I'll merge this and then play around with it to see if there's any different way to write it. Note, I pushed something and now it won't merge cleanly. Can you pull and merge then repush this? I'm not sure exactly what steps are required.

Ok, I'll merge this and then play around with it to see if there's any different way to write it. Note, I pushed something and now it won't merge cleanly. Can you pull and merge then repush this? I'm not sure exactly what steps are required.
Author
Contributor

done

done
wathiede approved these changes 2020-02-09 08:59:07 -08:00
wathiede closed this pull request 2020-02-09 08:59:14 -08:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wathiede/photosync#1
No description provided.