]> git.lizzy.rs Git - rust.git/commit
Change std::io::FilePermission to a typesafe representation
authorAaron Turon <aturon@mozilla.com>
Fri, 2 May 2014 17:56:26 +0000 (10:56 -0700)
committerAaron Turon <aturon@mozilla.com>
Mon, 5 May 2014 22:24:36 +0000 (15:24 -0700)
commit8d1d7d9b5f3920d70b1edcc258a86106527e83f7
tree2c699707e94f9c3676bfdc3ee0492d728d3ff641
parentc00d8fd9a07244a13d1cc7162a80c3d618935ce8
Change std::io::FilePermission to a typesafe representation

This patch changes `std::io::FilePermissions` from an exposed `u32`
representation to a typesafe representation (that only allows valid
flag combinations) using the `std::bitflags`, thus ensuring a greater
degree of safety on the Rust side.

Despite the change to the type, most code should continue to work
as-is, sincde the new type provides bit operations in the style of C
flags. To get at the underlying integer representation, use the `bits`
method; to (unsafely) convert to `FilePermissions`, use
`FilePermissions::from_bits`.

Closes #6085.

[breaking-change]
src/libnative/io/file_unix.rs
src/libnative/io/file_win32.rs
src/librustuv/file.rs
src/librustuv/uvio.rs
src/libstd/io/fs.rs
src/libstd/io/mod.rs