#no-std #option #union #untagged #tagless

nightly no-std untagged-option

An unsafe Option type without discriminant. Nightly only.

3 unstable releases

Uses old Rust 2015

0.2.0 Nov 9, 2019
0.1.1 Sep 6, 2017
0.1.0 Sep 6, 2017

#10 in #union

Download history 32/week @ 2021-08-11 22/week @ 2021-08-18 35/week @ 2021-08-25 4/week @ 2021-09-01 37/week @ 2021-09-08 19/week @ 2021-09-15 5/week @ 2021-09-22 5/week @ 2021-09-29 15/week @ 2021-10-06 26/week @ 2021-10-13 22/week @ 2021-10-20 32/week @ 2021-10-27 39/week @ 2021-11-03 32/week @ 2021-11-10 44/week @ 2021-11-17 39/week @ 2021-11-24

159 downloads per month

CC0 license

7KB
62 lines

untagged-option

Build Status Crates.io

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.


lib.rs:

Provides an unsafe tagless alternative to Option<T> that uses less memory.

Nightly-only. #![no_std].

No runtime deps