takecell 0.1.1

A cell type which value can only be taken once
Documentation
  • Coverage
  • 100%
    21 out of 21 items documented5 out of 21 items with examples
  • Size
  • Source code size: 23.78 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 830.48 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • WaffleLapkin/takecell
    14 1 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • WaffleLapkin

takecell

lib.rs docs

takecell provides two new cell-like types, TakeCell and TakeOwnCell. Both may store arbitrary non-Copy types, can be read from at most once and provide direct unique access to the stored contents. The core API looks roughly like this:

impl<T> TakeCell<T> {
    const fn new(v: T) -> Self { ... }
}
impl<T: ?Sized> TakeCell<T> {
    fn take(&self) -> Option<&mut T> { ... }
}

impl<T> TakeOwnCell<T> {
    const fn new(v: T) -> Self { ... }
    fn take(&self) -> Option<T> { ... }
}

To use this crate add the following to your Cargo.toml:

[dependencies] 
takecell = "0.1"