#unsafe #union #debug-mode #type #debugging #assertions

blair_mountain

Union types in release mode with debug assertions in debug mode

4 releases (2 breaking)

0.3.0 Feb 23, 2020
0.2.0 Feb 23, 2020
0.1.1 Feb 21, 2020
0.1.0 Feb 21, 2020

#24 in #debug-mode

MPL-2.0 license

11KB
185 lines

blair_mountain

A crate that exports one macro (union) to create types that are enums with checks in debug mode, but unions in release mode. In debug mode, invalid access will panic, while in release they will not. It is therefore unsafe. Fields should be treated as fields of unions (i.e no non-Copy types allowed, etc). Please test all code generated with blair_mountain in both release and debug modes.


lib.rs:

A crate that exports one macro (union) to create types that are enums with checks in debug mode, but unions in release mode. In debug mode, invalid access will panic, while in release they will not. It is therefore unsafe. Fields should be treated as fields of unions (i.e no non-Copy types allowed, etc). Please test all code generated with blair_mountain in both release and debug modes.

Dependencies

~11KB