Module safe_transmute::bool
source · Expand description
Functions for safe transmutation to bool
.
Transmuting to bool
is not undefined behavior if the transmuted value is
either 0 or 1. These functions will return an error if the integer value
behind the bool
value is neither one.
§Note
Currently, these functions only work on systems in which the size of bool
is exactly 1 (which are all platforms supported by Rust at the time of
writing). In the event that you find a platform with an unexpected bool
size, please report at the project’s
issue tracker.
Functions§
- Makes sure that the bytes represent a sequence of valid boolean values.
- View a byte slice as a slice of boolean values.
- View a byte slice as a slice of boolean values.
- Transform a byte vector into a vector of bool.
- Trasform a byte vector into a vector of bool.