abibool 0.5.0

C ABI compatible boolean types
Documentation

abibool - C ABI compatible boolean types

GitHub crates.io docs.rs License Build Status

For most sane rust APIs, you should prefer bool in your interfaces and simply convert between types. However, bool isn't legal for all bit patterns, making it unusable for most FFI without conversions. For simple FFI, this isn't a problem, but C APIs writing arrays of BOOL or BOOLEAN, or structures containing these types, become problematic and require allocations and copies to avoid undefined behavior. Alternatively, you could just use integer types, that can obfuscate intent and result in bugs if multiple truthy-but-different value are directly compared when you expect boolean logic.

See The Documentation for details.

abibool type winapi type
b8 / bool8 BOOLEAN
b32 / bool32 BOOL

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.