]> git.lizzy.rs Git - rust.git/commit
Add (unsafe) coercion from bits to std::bitflags
authorAaron Turon <aturon@mozilla.com>
Fri, 2 May 2014 17:41:07 +0000 (10:41 -0700)
committerAaron Turon <aturon@mozilla.com>
Mon, 5 May 2014 22:24:36 +0000 (15:24 -0700)
commitc00d8fd9a07244a13d1cc7162a80c3d618935ce8
tree377273474798d8fae7931491ccddab89b81efd2c
parentb733df0fc7942aea205d8fc451d2a4d17d47dfe9
Add (unsafe) coercion from bits to std::bitflags

The intent of `std::bitflags` is to allow building type-safe wrappers
around C-style flags APIs. But in addition to construction these flags
from the Rust side, we need a way to convert them from the C
side. This patch adds a `from_bits` function, which is unsafe since
the bits in question may not represent a valid combination of flags.
src/libstd/bitflags.rs