damnit i’m typing ?: into my rust again
2
what i actually want is list.get(i-1) instead of writing it out longhand
2
If I knew the shape of what you had and what you wanted, I might be able to make a suggestion.
1
well i started with something like line 581 except using [] instead of .get(), then i realised everything needed to be Option<>al, so I used bare .get(), then the compiler complained at me for doing 0usize - 1usize so i put one of the if{}else{}s back github.com/fanf2/leapsecs/bl…
1
i want something like a backwards .peek()
1
hmm but i can do a backwards peek with a mutable prev variable and now my problem is that slice::Iter isn’t peekable
1
but it is if i slap a .peekable() on it
1
I'm just trying to grok what you actually need in terms of data. Is it that for each entry in the list you want (prev,this,next) where at the start that'd be (None,entry,Some(next)) and a the end it'd be (Some(prev),entry,None) ?
1
exactly i tried a version with .peek() and it turned out to be more annoying play.rust-lang.org/?version=…
1
Replying to @fanf
This isn't *quite* what you're after, but it's close (Option,Option,Option) rather than (Option,value,Option) -- play.rust-lang.org/?version=…

May 11, 2021 Β· 3:50 PM UTC

1
1
Replying to @dsilverstone
ah i thought there might be something in itertools πŸ€“
1
1
itertools is love. itertools is life. (oh, and rayon too, rayon is happiness)
3