datrs / flat-tree

Map a binary tree to a vector.
Apache License 2.0
53 stars 10 forks source link

Return more Option types. #23

Open yoshuawuyts opened 6 years ago

yoshuawuyts commented 6 years ago

Some cases to consider:

I'm thinking we should perhaps return the Option type more often in both FlatTree and the Iterator structs.

yoshuawuyts commented 6 years ago

Speak of the devil. Ran into the .prev() issue.

2018-04-23-175550_3840x2160

ralphtheninja commented 6 years ago

@yoshuawuyts But we're checking index in .prev()

https://github.com/datrs/flat-tree/blob/30f6a0791813fb3fb87b4024b1136e5c13d6e1b0/src/iterator.rs#L65-L67

yoshuawuyts commented 6 years ago

apparently it can slip through and still crash. Error originates on Iterator, line 69 :disappointed: