keypropdecode/
lib.rs

1//! # keypropdecode
2//! A library for decoding windows file system element properties.  
3//! Since Windows stores these properties as a number and each individual property is stored in a determined bit of that number, decoding it can bloat the code.  
4//! This library attemps to solve this.
5//! You can use this crate with different purposes:
6//! 1. You can provide an `u32`, with the From trait, and get back a Props instance with the correspondent properties.
7//! 2. You can provide a `PathBuf` or a reference to it, with the TryFrom trait, and you won't have
8//!    to extract the correspondent properties. You can also provide a valid `&str`.  
9//! 3. With the properties correctly set you can get the `u32` correpondent to those properties you
10//!    set. The library will ensure you don't set invalid states
11//! 4. The `Display` implementation of the struct return a `String` identical as the one that prints with `GetChild-Item` in PowerShell, which are the most commonly used.  
12//!
13//! For reference with all the file system element properties go to the [Microsoft File Attribute Constants Documentation](https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants).  
14//! The implementation of the library uses enums to make invalid states unrepresentable.  
15//! It is strongly recommended that **if you don't know what a property does, don't change it**.  
16//! ## Example
17//! ```Rust
18//! use keypropdecode::Props;
19//! let mut props = Props::default();
20//! props.change_element_type(ArcDir::Archive(ArchiveProps::default()));
21//! assert_eq!(Props::try_from(r"hidden_file_example.txt").unwrap(), props);
22//! ```
23
24/// The Error type for the crate
25pub mod error;
26/// The main module of the library
27pub mod props;
28/// The re-export of the main Struct of the library
29pub use props::Props;