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

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

#38 in #union

Download history 97/week @ 2024-07-22 94/week @ 2024-07-29 111/week @ 2024-08-05 113/week @ 2024-08-12 88/week @ 2024-08-19 88/week @ 2024-08-26 74/week @ 2024-09-02 79/week @ 2024-09-09 90/week @ 2024-09-16 135/week @ 2024-09-23 90/week @ 2024-09-30 9/week @ 2024-10-07 58/week @ 2024-10-14 75/week @ 2024-10-21 68/week @ 2024-10-28 70/week @ 2024-11-04

272 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