|
1 | 1 | use std::{
|
2 | 2 | io,
|
3 |
| - os::windows::fs::MetadataExt, |
4 | 3 | path::Path,
|
5 | 4 | time::{Duration, SystemTime},
|
6 | 5 | };
|
@@ -144,49 +143,50 @@ impl Metadata {
|
144 | 143 | pub fn created(&self) -> io::Result<SystemTime> {
|
145 | 144 | Ok(filetime_to_systemtime(self.stat.ftCreationTime))
|
146 | 145 | }
|
147 |
| -} |
148 | 146 |
|
149 |
| -impl MetadataExt for Metadata { |
150 |
| - fn file_attributes(&self) -> u32 { |
| 147 | + /// Returns the value of the `dwFileAttributes` field of this metadata. |
| 148 | + pub fn file_attributes(&self) -> u32 { |
151 | 149 | self.stat.dwFileAttributes
|
152 | 150 | }
|
153 | 151 |
|
154 |
| - fn creation_time(&self) -> u64 { |
| 152 | + /// Returns the value of the `ftCreationTime` field of this metadata. |
| 153 | + pub fn creation_time(&self) -> u64 { |
155 | 154 | filetime_u64(self.stat.ftCreationTime)
|
156 | 155 | }
|
157 | 156 |
|
158 |
| - fn last_access_time(&self) -> u64 { |
| 157 | + /// Returns the value of the `ftLastAccessTime` field of this metadata. |
| 158 | + pub fn last_access_time(&self) -> u64 { |
159 | 159 | filetime_u64(self.stat.ftLastAccessTime)
|
160 | 160 | }
|
161 | 161 |
|
162 |
| - fn last_write_time(&self) -> u64 { |
| 162 | + /// Returns the value of the `ftLastWriteTime` field of this metadata. |
| 163 | + pub fn last_write_time(&self) -> u64 { |
163 | 164 | filetime_u64(self.stat.ftLastWriteTime)
|
164 | 165 | }
|
165 | 166 |
|
166 |
| - fn file_size(&self) -> u64 { |
167 |
| - self.len() |
168 |
| - } |
169 |
| - |
170 |
| - #[cfg(feature = "windows_by_handle")] |
171 |
| - fn volume_serial_number(&self) -> Option<u32> { |
| 167 | + /// Returns the value of the `dwVolumeSerialNumber` field of this |
| 168 | + /// metadata. |
| 169 | + pub fn volume_serial_number(&self) -> Option<u32> { |
172 | 170 | if self.handle_info {
|
173 | 171 | Some(self.stat.dwVolumeSerialNumber)
|
174 | 172 | } else {
|
175 | 173 | None
|
176 | 174 | }
|
177 | 175 | }
|
178 | 176 |
|
179 |
| - #[cfg(feature = "windows_by_handle")] |
180 |
| - fn number_of_links(&self) -> Option<u32> { |
| 177 | + /// Returns the value of the `nNumberOfLinks` field of this |
| 178 | + /// metadata. |
| 179 | + pub fn number_of_links(&self) -> Option<u32> { |
181 | 180 | if self.handle_info {
|
182 | 181 | Some(self.stat.nNumberOfLinks)
|
183 | 182 | } else {
|
184 | 183 | None
|
185 | 184 | }
|
186 | 185 | }
|
187 | 186 |
|
188 |
| - #[cfg(feature = "windows_by_handle")] |
189 |
| - fn file_index(&self) -> Option<u64> { |
| 187 | + /// Returns the value of the `nFileIndex{Low,High}` fields of this |
| 188 | + /// metadata. |
| 189 | + pub fn file_index(&self) -> Option<u64> { |
190 | 190 | if self.handle_info {
|
191 | 191 | Some(create_u64(
|
192 | 192 | self.stat.nFileIndexHigh,
|
|
0 commit comments