diff options
| author | bors <bors@rust-lang.org> | 2014-03-12 21:21:44 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-12 21:21:44 -0700 |
| commit | e86e1d88b2842671123d0a072d00c94bd3f39264 (patch) | |
| tree | 946860b413e83873d8ed9a479b6f1edaa6d80b4b /src/libstd | |
| parent | a53242a1a38301b4a40be71fcd182568b7ee91b6 (diff) | |
| parent | 62026fd6b64296c85a8150119e2cd6a162b8b5e0 (diff) | |
| download | rust-e86e1d88b2842671123d0a072d00c94bd3f39264.tar.gz rust-e86e1d88b2842671123d0a072d00c94bd3f39264.zip | |
auto merge of #12822 : erickt/rust/cleanup, r=acrichto
This PR makes `std::io::FileStat` hashable, and `Path` serializable as a byte array.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/mod.rs | 4 | ||||
| -rw-r--r-- | src/libstd/path/posix.rs | 6 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 6 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 1c10c7b61c3..c6795fad1a5 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1320,7 +1320,7 @@ pub enum FileAccess { } /// Different kinds of files which can be identified by a call to stat -#[deriving(Eq, Show)] +#[deriving(Eq, Show, Hash)] pub enum FileType { /// This is a normal file, corresponding to `S_IFREG` TypeFile, @@ -1358,6 +1358,7 @@ pub enum FileType { /// println!("byte size: {}", info.size); /// # } /// ``` +#[deriving(Hash)] pub struct FileStat { /// The path that this stat structure is describing path: Path, @@ -1399,6 +1400,7 @@ pub struct FileStat { /// have different meanings or no meaning at all on some platforms. #[unstable] #[allow(missing_doc)] +#[deriving(Hash)] pub struct UnstableFileStat { device: u64, inode: u64, diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index f7588f6ca59..8345a2d04d1 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -88,10 +88,10 @@ impl ToCStr for Path { } } -impl<H: Writer> ::hash::Hash<H> for Path { +impl<S: Writer> ::hash::Hash<S> for Path { #[inline] - fn hash(&self, hasher: &mut H) { - self.repr.hash(hasher) + fn hash(&self, state: &mut S) { + self.repr.hash(state) } } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 6d05001beab..180078ae959 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -112,10 +112,10 @@ impl ToCStr for Path { } } -impl<H: Writer> ::hash::Hash<H> for Path { +impl<S: Writer> ::hash::Hash<S> for Path { #[inline] - fn hash(&self, hasher: &mut H) { - self.repr.hash(hasher) + fn hash(&self, state: &mut S) { + self.repr.hash(state) } } |
