|
3 | 3 | use crate::alloc::{Layout, alloc, dealloc};
|
4 | 4 | use crate::borrow::Cow;
|
5 | 5 | use crate::ffi::{OsStr, OsString, c_void};
|
| 6 | +use crate::hash::{Hash, Hasher}; |
6 | 7 | use crate::io::{self, BorrowedCursor, Error, IoSlice, IoSliceMut, SeekFrom};
|
7 | 8 | use crate::mem::{self, MaybeUninit, offset_of};
|
8 | 9 | use crate::os::windows::io::{AsHandle, BorrowedHandle};
|
@@ -39,7 +40,7 @@ pub struct FileAttr {
|
39 | 40 | file_index: Option<u64>,
|
40 | 41 | }
|
41 | 42 |
|
42 |
| -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
| 43 | +#[derive(Copy, Clone, Eq, Debug)] |
43 | 44 | pub struct FileType {
|
44 | 45 | attributes: u32,
|
45 | 46 | reparse_tag: u32,
|
@@ -1140,6 +1141,18 @@ impl FileType {
|
1140 | 1141 | }
|
1141 | 1142 | }
|
1142 | 1143 |
|
| 1144 | +impl PartialEq for FileType { |
| 1145 | + fn eq(&self, other: &Self) -> bool { |
| 1146 | + self.is_directory() == other.is_directory() && self.is_symlink() == other.is_symlink() |
| 1147 | + } |
| 1148 | +} |
| 1149 | + |
| 1150 | +impl Hash for FileType { |
| 1151 | + fn hash<H: Hasher>(&self, state: &mut H) { |
| 1152 | + state.write(&[self.is_directory() as u8, self.is_symlink() as u8]); |
| 1153 | + } |
| 1154 | +} |
| 1155 | + |
1143 | 1156 | impl DirBuilder {
|
1144 | 1157 | pub fn new() -> DirBuilder {
|
1145 | 1158 | DirBuilder
|
|
0 commit comments