Skip to content

Commit 005259b

Browse files
committed
fix(fs): don't impl MetadataExt on Windows
1 parent 7191bdb commit 005259b

File tree

4 files changed

+17
-27
lines changed

4 files changed

+17
-27
lines changed

compio-fs/Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,3 @@ windows-sys = { workspace = true, features = ["Win32_Security_Authorization"] }
5757
# Unix specific dev dependencies
5858
[target.'cfg(unix)'.dev-dependencies]
5959
nix = { workspace = true, features = ["fs"] }
60-
61-
[features]
62-
windows_by_handle = []
63-
nightly = ["windows_by_handle"]

compio-fs/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
33
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
44
#![warn(missing_docs)]
5-
#![cfg_attr(
6-
all(windows, feature = "windows_by_handle"),
7-
feature(windows_by_handle)
8-
)]
95

106
mod file;
117
pub use file::*;

compio-fs/src/metadata/windows.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::{
22
io,
3-
os::windows::fs::MetadataExt,
43
path::Path,
54
time::{Duration, SystemTime},
65
};
@@ -144,49 +143,50 @@ impl Metadata {
144143
pub fn created(&self) -> io::Result<SystemTime> {
145144
Ok(filetime_to_systemtime(self.stat.ftCreationTime))
146145
}
147-
}
148146

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 {
151149
self.stat.dwFileAttributes
152150
}
153151

154-
fn creation_time(&self) -> u64 {
152+
/// Returns the value of the `ftCreationTime` field of this metadata.
153+
pub fn creation_time(&self) -> u64 {
155154
filetime_u64(self.stat.ftCreationTime)
156155
}
157156

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 {
159159
filetime_u64(self.stat.ftLastAccessTime)
160160
}
161161

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 {
163164
filetime_u64(self.stat.ftLastWriteTime)
164165
}
165166

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> {
172170
if self.handle_info {
173171
Some(self.stat.dwVolumeSerialNumber)
174172
} else {
175173
None
176174
}
177175
}
178176

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> {
181180
if self.handle_info {
182181
Some(self.stat.nNumberOfLinks)
183182
} else {
184183
None
185184
}
186185
}
187186

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> {
190190
if self.handle_info {
191191
Some(create_u64(
192192
self.stat.nFileIndexHigh,

compio/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,12 @@ read_buf = [
107107
"compio-tls?/read_buf",
108108
]
109109
try_trait_v2 = ["compio-buf/try_trait_v2"]
110-
windows_by_handle = ["compio-fs?/windows_by_handle"]
111110
nightly = [
112111
"allocator_api",
113112
"lazy_cell",
114113
"once_cell_try",
115114
"read_buf",
116115
"try_trait_v2",
117-
"windows_by_handle",
118116
]
119117

120118
[[example]]

0 commit comments

Comments
 (0)