linear_type

Crates.iolinear_type
lib.rslinear_type
version0.5.0
sourcesrc
created_at2023-09-13 18:30:35.208602
updated_at2024-05-10 12:59:43.986844
descriptionLinear types for rust
homepage
repositoryhttps://git.pipapo.org/cehteh/linear_type.git
max_upload_size
id971758
size5,892
(cehteh)

documentation

README

About

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().

Status

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.

Features

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.

Commit count: 0

cargo fmt