Skip to content

Commit be12c9f

Browse files
committed
std: allow io::File* structs to be hashable
1 parent 4d64441 commit be12c9f

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/libstd/io/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ pub enum FileAccess {
13201320
}
13211321

13221322
/// Different kinds of files which can be identified by a call to stat
1323-
#[deriving(Eq, Show)]
1323+
#[deriving(Eq, Show, Hash)]
13241324
pub enum FileType {
13251325
/// This is a normal file, corresponding to `S_IFREG`
13261326
TypeFile,
@@ -1358,6 +1358,7 @@ pub enum FileType {
13581358
/// println!("byte size: {}", info.size);
13591359
/// # }
13601360
/// ```
1361+
#[deriving(Hash)]
13611362
pub struct FileStat {
13621363
/// The path that this stat structure is describing
13631364
path: Path,
@@ -1399,6 +1400,7 @@ pub struct FileStat {
13991400
/// have different meanings or no meaning at all on some platforms.
14001401
#[unstable]
14011402
#[allow(missing_doc)]
1403+
#[deriving(Hash)]
14021404
pub struct UnstableFileStat {
14031405
device: u64,
14041406
inode: u64,

src/libstd/path/posix.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ impl ToCStr for Path {
8888
}
8989
}
9090

91-
impl<H: Writer> ::hash::Hash<H> for Path {
91+
impl<S: Writer> ::hash::Hash<S> for Path {
9292
#[inline]
93-
fn hash(&self, hasher: &mut H) {
94-
self.repr.hash(hasher)
93+
fn hash(&self, state: &mut S) {
94+
self.repr.hash(state)
9595
}
9696
}
9797

src/libstd/path/windows.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ impl ToCStr for Path {
112112
}
113113
}
114114

115-
impl<H: Writer> ::hash::Hash<H> for Path {
115+
impl<S: Writer> ::hash::Hash<S> for Path {
116116
#[inline]
117-
fn hash(&self, hasher: &mut H) {
118-
self.repr.hash(hasher)
117+
fn hash(&self, state: &mut S) {
118+
self.repr.hash(state)
119119
}
120120
}
121121

0 commit comments

Comments
 (0)