#options #untagged #union #no-std #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

#23 in #union

Download history 118/week @ 2023-11-20 82/week @ 2023-11-27 64/week @ 2023-12-04 102/week @ 2023-12-11 105/week @ 2023-12-18 88/week @ 2023-12-25 45/week @ 2024-01-01 125/week @ 2024-01-08 92/week @ 2024-01-15 75/week @ 2024-01-22 50/week @ 2024-01-29 87/week @ 2024-02-05 131/week @ 2024-02-12 98/week @ 2024-02-19 154/week @ 2024-02-26 134/week @ 2024-03-04

524 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