Skip to content

Commit

Permalink
warn(missing_docs) and add missing docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcefrog committed Oct 26, 2021
1 parent 583f92f commit 788e7bd
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![warn(missing_docs)]

//! Manipulate Unix file mode bits.
//!
//! Every filesystem entry (or inode) on Unix has a bit field of
Expand All @@ -27,7 +29,8 @@
//! ```
//!
//! The encoding is fairly standard across unices, and occurs in some file
//! formats and network protocols that might be seen on non-Unix platforms.
//! formats and network protocols that might be seen on non-Unix platforms, including that of
//! `rsync`.
//!
//! This library isn't Unix-specific and doesn't depend on the underlying OS to
//! interpret the bits.
Expand All @@ -47,7 +50,7 @@
//! * More tests.
//! * Move changelog into Rustdoc.
//!
//! ## 0.1.2 2021-08-1
//! ## 0.1.2
//!
//! * Add [is_setuid], [is_setgid], [is_sticky].
//!
Expand All @@ -73,14 +76,21 @@ fn type_bits(mode: u32) -> u32 {
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[non_exhaustive]
pub enum Type {
/// A plain file.
File,
/// A directory.
Dir,
/// A symbolic link.
Symlink,
/// A Unix-domain socket.
Socket,
/// A named pipe / FIFO.
Fifo,
/// A block device, such as a disk.
BlockDevice,
/// A character device, such as a `/dev/null`.
CharDevice,
/// Removed file in union filesystems
/// A removed file in union filesystems.
Whiteout,
/// File type not recognized by this version of this library
///
Expand Down Expand Up @@ -110,17 +120,25 @@ impl From<u32> for Type {
/// Enum for specifying the context / "who" accesses in [is_allowed]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Accessor {
/// Access by anyone other than the user or group.
Other,
/// Access by the group of the file.
Group,
/// Access by the owner of the file.
User,
}

/// Enum for specifying the type of access in [is_allowed]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Access {
/// (Beware: execute has various meanings depending on the type of file)
/// Permission to "execute", broadly.
///
/// For plain files, this does mean permission to execute. For directories, this grants
/// permission to open files within the directory whose name is known.
Execute,
/// Permission to write the file.
Write,
/// Permission to read the file, or to read the names of files in a directory.
Read,
}

Expand Down

0 comments on commit 788e7bd

Please sign in to comment.