Module safe_transmute::bool[][src]

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

bytes_are_bool

Makes sure that the bytes represent a sequence of valid boolean values.

transmute_bool_pedantic

View a byte slice as a slice of boolean values.

transmute_bool_permissive

View a byte slice as a slice of boolean values.

transmute_bool_vec_pedantic

Transform a byte vector into a vector of bool.

transmute_bool_vec_permissive

Trasform a byte vector into a vector of bool.