3 ms·
> For example, you can't get mutable references to items in a shared container by thread id or loop iteration. This would be a good candidate for a specialised
by dwattttt 9mo ago
> For example, you can't get mutable references to items in a shared container by thread id or loop iteration.
This would be a good candidate for a specialised container that internally used unsafe. Well, thread id at least; since the user of an API doesn't provide it, you could mark the API safe, since you wouldn't have to worry about incorrect inputs.
Loop iteration would be an input to the API, so you'd mark the API unsafe.
- unrealhoang 9mo agoThere’s split_at_mut to avoid writing unsafe yourself in this case.