3 unstable releases

0.2.0 Jan 30, 2022
0.1.1 Oct 9, 2018
0.1.0 Oct 9, 2018

#173 in Memory management

Download history 1875/week @ 2025-10-13 1977/week @ 2025-10-20 1567/week @ 2025-10-27 2017/week @ 2025-11-03 1648/week @ 2025-11-10 1364/week @ 2025-11-17 1594/week @ 2025-11-24 1780/week @ 2025-12-01 1500/week @ 2025-12-08 1851/week @ 2025-12-15 745/week @ 2025-12-22 1255/week @ 2025-12-29 2300/week @ 2026-01-05 1935/week @ 2026-01-12 2776/week @ 2026-01-19 1805/week @ 2026-01-26

8,871 downloads per month
Used in 18 crates (7 directly)

MIT license

11KB
112 lines

PinCell

This library defines the PinCell type, a pinning variant of the standard library's RefCell.

It is not safe to "pin project" through a RefCell - getting a pinned reference to something inside the RefCell when you have a pinned refernece to the RefCell - because RefCell is too powerful.

A PinCell is slightly less powerful than RefCell: unlike a RefCell, one cannot get a mutable reference into a PinCell, only a pinned mutable reference (Pin<&mut T>). This makes pin projection safe, allowing you to use interior mutability with the knowledge that T will never actually be moved out of the RefCell that wraps it.

License

Licensed under MIT license.

No runtime deps