Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wafflelapkin/takecell
A cell type which value can only be taken once
https://github.com/wafflelapkin/takecell
Last synced: 6 days ago
JSON representation
A cell type which value can only be taken once
- Host: GitHub
- URL: https://github.com/wafflelapkin/takecell
- Owner: WaffleLapkin
- License: mit
- Created: 2021-09-04T18:17:06.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-03T14:32:51.000Z (almost 3 years ago)
- Last Synced: 2024-11-01T02:34:26.803Z (14 days ago)
- Language: Rust
- Homepage: https://docs.rs/takecell/
- Size: 15.6 KB
- Stars: 14
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# takecell
[![lib.rs](https://img.shields.io/badge/lib.rs-%20-8844ff)](https://lib.rs/crates/takecell)
[![docs](https://docs.rs/takecell/badge.svg)](https://docs.rs/takecell)`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:```rust,ignore
impl TakeCell {
const fn new(v: T) -> Self { ... }
}
impl TakeCell {
fn take(&self) -> Option<&mut T> { ... }
}impl TakeOwnCell {
const fn new(v: T) -> Self { ... }
fn take(&self) -> Option { ... }
}
```To use this crate add the following to your `Cargo.toml`:
```toml
[dependencies]
takecell = "0.1"
```