| Crates.io | stackpin |
| lib.rs | stackpin |
| version | 0.0.2 |
| created_at | 2019-10-12 09:33:43.094223+00 |
| updated_at | 2019-10-12 09:37:07.040711+00 |
| description | Crate for data that should be pinned to the stack at the point of declaration. |
| homepage | |
| repository | https://github.com/dureuill/stackpin |
| max_upload_size | |
| id | 171874 |
| size | 46,219 |
This crate exposes a StackPinned type that allows to represent !Unpin data that should be pinned to the stack at the point of declaration.
To do so, this crate provides a FromUnpinned trait and a stack_let! macro that enable safe construction of Pin<StackPinned> objects (aliased to PinStack for short).
Getting instances pinned at the point of declaration is as easy as:
stack_let!(unmovable = Unmovable::new_unpinned("Intel the Beagle")); // this creates the unmovable instance on the stack and binds `unmovable` with a `PinStack<Unmovable>`
For Unmovable a struct implementing the FromUnpinned<String> trait.
See the crate documentation for details, or look directly at the examples.