Proper iteration over Foundation types #304
Labels
A-framework
Affects the framework crates and the translator for them
enhancement
New feature or request
I-unsound
A soundness hole
Milestone
The way we do
NSEnumerator
andNSFastEnumeration
right now is a mess!Ideally, I don't think
NSEnumerator
should have a lifetime (it would allow it to be treated normally inicrate
). This means that any method that creates anNSEnumerator
is inherentlyunsafe
, but instead I think we should just create proper methods andIterator
wrappers where applicable.Rough sketches below. Note that the iterator must sometimes hold a reference to the array, since otherwise the array could be modified. Luckily the returned items can have the same lifetime as the array (instead of e.g. the same lifetime as the iterator).
See also #29 (comment)
The text was updated successfully, but these errors were encountered: