Crates.io | linear_type |
lib.rs | linear_type |
version | 0.5.0 |
source | src |
created_at | 2023-09-13 18:30:35.208602 |
updated_at | 2024-05-10 12:59:43.986844 |
description | Linear types for rust |
homepage | |
repository | https://git.pipapo.org/cehteh/linear_type.git |
max_upload_size | |
id | 971758 |
size | 5,892 |
This crate defines a Linear<T>
type. This is a type whose values can not be dropped and must
be eventually consumed with the into_inner()
method. Failing to do so will result in a panic
or compile error.
Unlike Pin
linear types can be moved and unlike ManuallyDrop
linear types require to be
eventually deconstructed unless they are forgotten with mem::forget()
.
This crate started on a discussion on IRC. It does not implement pure linear-type theory as this would require language support. Consider it as proof-of-concept. It may have some use and should be safe (in the rust sense) to use. Improvements and PR's are welcome. This crate will be somewhat in flux before a 1.0 version is released.
When this crates is compiled with the 'compile_error' feature flag then it will use the
'no-panic' crate to generate compile errors whenever Linear<T>
will be dropped.
Please read https://github.com/dtolnay/no-panic#caveats for details.