Skip to content

Commit

Permalink
Rollup merge of #116540 - daxpedda:once-cell-lock-try-insert, r=Mark-…
Browse files Browse the repository at this point in the history
…Simulacrum

Implement `OnceCell/Lock::try_insert()`

I took inspiration from [`once_cell`](https://crates.io/crates/once_cell):
- [`once_cell::unsync::OnceCell::try_insert()`](https://github.com/matklad/once_cell/blob/874f9373abd7feaf923a3b3c34bfb3383529c671/src/lib.rs#L551-L563)
- [`once_cell::sync::OnceCell::try_insert()`](https://github.com/matklad/once_cell/blob/874f9373abd7feaf923a3b3c34bfb3383529c671/src/lib.rs#L1080-L1087)

I tried to change as little code as possible in the first commit and applied some obvious optimizations in the second one.

ACP: rust-lang/libs-team#276
Tracking issue: #116693
  • Loading branch information
GuillaumeGomez committed Oct 14, 2023
2 parents cd20584 + 2e3fa3e commit c553f51
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit c553f51

Please sign in to comment.