nanoval - A NaN-tagged value
This library provides an implementation of a NaN-tagged value supporting f64, bool, i32, u32, null-values and a
subset of pointers.
Each value is only 8 bytes in size and uses the large space of NaN values to store additional information inside a
single
64 bit double precision floating point value.
This implementation is heavily inspired by the Wren programming language, although it does differ in some aspects.
If you find a bug or have ideas for improvements, please open an issue or a pull request.
I hope you find this library useful!
Usage
The Value type can be constructed from f64, bool, i32, u32, () and pointers and references to arbitrary T:
use Value;
let double = from;
let integer = from;
let boolean = from;
let null = from;
let pointer = from;
The constructed value can be converted back to the original type:
assert_eq!;
assert_eq!;
assert_eq!;
assert!;
assert_eq!;