1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15+ #![ warn( missing_docs) ]
16+
1517//! Manipulate Unix file mode bits.
1618//!
1719//! Every filesystem entry (or inode) on Unix has a bit field of
2729//! ```
2830//!
2931//! The encoding is fairly standard across unices, and occurs in some file
30- //! formats and network protocols that might be seen on non-Unix platforms.
32+ //! formats and network protocols that might be seen on non-Unix platforms, including that of
33+ //! `rsync`.
3134//!
3235//! This library isn't Unix-specific and doesn't depend on the underlying OS to
3336//! interpret the bits.
4750//! * More tests.
4851//! * Move changelog into Rustdoc.
4952//!
50- //! ## 0.1.2 2021-08-1
53+ //! ## 0.1.2
5154//!
5255//! * Add [is_setuid], [is_setgid], [is_sticky].
5356//!
@@ -73,14 +76,21 @@ fn type_bits(mode: u32) -> u32 {
7376#[ derive( Debug , PartialEq , Eq , Clone , Copy ) ]
7477#[ non_exhaustive]
7578pub enum Type {
79+ /// A plain file.
7680 File ,
81+ /// A directory.
7782 Dir ,
83+ /// A symbolic link.
7884 Symlink ,
85+ /// A Unix-domain socket.
7986 Socket ,
87+ /// A named pipe / FIFO.
8088 Fifo ,
89+ /// A block device, such as a disk.
8190 BlockDevice ,
91+ /// A character device, such as a `/dev/null`.
8292 CharDevice ,
83- /// Removed file in union filesystems
93+ /// A removed file in union filesystems.
8494 Whiteout ,
8595 /// File type not recognized by this version of this library
8696 ///
@@ -110,17 +120,25 @@ impl From<u32> for Type {
110120/// Enum for specifying the context / "who" accesses in [is_allowed]
111121#[ derive( Debug , PartialEq , Eq , Clone , Copy ) ]
112122pub enum Accessor {
123+ /// Access by anyone other than the user or group.
113124 Other ,
125+ /// Access by the group of the file.
114126 Group ,
127+ /// Access by the owner of the file.
115128 User ,
116129}
117130
118131/// Enum for specifying the type of access in [is_allowed]
119132#[ derive( Debug , PartialEq , Eq , Clone , Copy ) ]
120133pub enum Access {
121- /// (Beware: execute has various meanings depending on the type of file)
134+ /// Permission to "execute", broadly.
135+ ///
136+ /// For plain files, this does mean permission to execute. For directories, this grants
137+ /// permission to open files within the directory whose name is known.
122138 Execute ,
139+ /// Permission to write the file.
123140 Write ,
141+ /// Permission to read the file, or to read the names of files in a directory.
124142 Read ,
125143}
126144
0 commit comments