Repository navigation
Expose windows file attributes. - #427
Conversation
d92b887 to
900db78
Compare
Mirror std `FileType` `Debug` impl.
900db78 to
d41814e
Compare
<!-- agent --> ### Added - Introduce `FileAttributes` with named, combinable flags and readable debug output. - Add an opt-in `unstable` feature for the Windows attribute API, keeping it available automatically to unit tests. ### Changed - Use concise tuple-style `FileType` debug output on macOS and Windows, such as `FileType(Directory)`. - Document query-specific attribute semantics without assuming directory enumeration returns a strict subset of flags. Assisted-by: GPT 6.0 Astra Co-authored-by: GPT 6.0 Astra <codex@openai.com>
8dae267 to
ca235bd
Compare
|
@Byron thanks for merging. Btw why did you change the Debug impls? I copied them exactly from the rust std lib. |
|
Yes, they are changed to be more concise. |
|
It's fine. #[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for FileType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("FileType")
.field("is_file", &self.is_file())
.field("is_dir", &self.is_dir())
.field("is_symlink", &self.is_symlink())
.finish_non_exhaustive()
}
}I was also surprised rust picked the above for the std Debug impl. |
|
Also I am curious why gate it behind unstable? Rust std has stable support for file_attributes on windows: https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.file_attributes Will this become stable or is it just because it is a feature that is platform specific? I am pretty sure windows might add flags but they will never remove/change existing ones. |
|
The method is unstable because I don't want to commit to it forever. |
|
Makes sense. I think all changes work fine for my use case. Thanks for cutting a release. |
FileTypeDebugimpl.Also cool to see
#[must_use]littered in a code base for once. I think rust should really make all types must use by default. Hopefully they will do it in a future edition. I think it should be opt-out rather than opt-in. I mean rust already has the very nice_and it makes functions that return something obvious.