Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TakeCell::get_mut function #2077

Merged
merged 2 commits into from
Sep 9, 2020
Merged

Add TakeCell::get_mut function #2077

merged 2 commits into from
Sep 9, 2020

Commits on Aug 15, 2020

  1. Add TakeCell::get_mut function

    This bypasses the Cell nature of take_cell for situations where you
    already have access to an `&mut TakeCell`. Similarly to how the
    corresponding method in `Cell`, `Cell::get_mut` is safe,
    `TakeCell::get_mut` is entirely safe and requires no new unsafe code to
    implement. It's made safe by the fact that the returned value is
    lifetime bound to the takecell itself, not to `'a`.
    
    This was useful for an odd interaction with the rubble interface when
    implementing tock_rubble - it needs to retrieve an `&mut [u8]` multiple
    times safely, and then also use that buffer as an `&'static mut [u8]`
    which can be taken out. Thus a `TakeCell`, with the addition of this
    `get_mut` method, works well.
    
    Signed-off-by: David Ross <David.Ross@wdc.com>
    David Ross authored and David Ross committed Aug 15, 2020
    Configuration menu
    Copy the full SHA
    4eb3414 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2020

  1. Apply suggested documentation change

    Signed-off-by: David Ross <David.Ross@wdc.com>
    David Ross authored and David Ross committed Aug 17, 2020
    Configuration menu
    Copy the full SHA
    162efed View commit details
    Browse the repository at this point in the history