#options #union #tagless #untagged #no-std

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

#5 in #untagged

Download history 101/week @ 2024-03-14 138/week @ 2024-03-21 236/week @ 2024-03-28 128/week @ 2024-04-04 140/week @ 2024-04-11 169/week @ 2024-04-18 139/week @ 2024-04-25 121/week @ 2024-05-02 125/week @ 2024-05-09 121/week @ 2024-05-16 123/week @ 2024-05-23 128/week @ 2024-05-30 75/week @ 2024-06-06 100/week @ 2024-06-13 122/week @ 2024-06-20 64/week @ 2024-06-27

384 downloads per month

CC0 license

8KB
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