tokio-rs / slab

Slab allocator for Rust
MIT License
699 stars 84 forks source link

Add `get2_mut` and `get2_unchecked_mut`. #65

Closed ksqsf closed 3 years ago

ksqsf commented 5 years ago

This should fix #64.

tormol commented 5 years ago

Hello @ksqsf

The reason I looked at this PR is because two equal indexes isn't the most obvious edge case :)

Would it make sense to return a single Option<(&mut T, &mut T)> instead? I assume that in most cases either index being invalid is a bug, and returning a single option makes it easier to .unwrap().

ksqsf commented 5 years ago

Hi @tormol Thanks for your review. Just committed the changes.

carllerche commented 5 years ago

@tormol You are a +1 on the PR?

tormol commented 5 years ago

Yes