Crates.io | untagged-option |
lib.rs | untagged-option |
version | 0.2.0 |
source | src |
created_at | 2017-09-06 16:49:16.260554 |
updated_at | 2019-11-09 14:41:03.4385 |
description | An unsafe Option type without discriminant. Nightly only. |
homepage | |
repository | https://github.com/jonas-schievink/untagged-option.git |
max_upload_size | |
id | 30814 |
size | 14,098 |
untagged-option
This crate provides the UntaggedOption
type, an unsafe alternative to the existing Option
.
In contrast to Option
, UntaggedOption
does not have a discriminant and thus does not know whether it contains a value or not, which makes the type very unsafe to use. It's the user's responsibility to only call UntaggedOption
's methods when appropriate.
UntaggedOption
is useful in contexts where the discriminant of Option
would consume significant amounts of memory (eg. microcontrollers). Building a safe abstraction on top of it allows safe and resource-friendly usage.