Expand description
library ~ (core/bundler file)
Re-exports§
pub extern crate libc;
Modules§
- backup_
control - Implement GNU-style backup functionality.
- buf_
copy - This module provides several buffer-based copy/write functions that leverage
the
splice
system call in Linux systems, thus increasing the I/O performance of copying between two file descriptors. This module is mostly used by utilities to work around the limitations of Rust’sfs::copy
which does not handle copying special files (e.g pipes, character/block devices). - checksum
- colors
- Provides color handling for
ls
and other utilities. - custom_
tz_ fmt - display
- Utilities for printing paths, with special attention paid to special characters and invalid unicode.
- encoding
- entries
- Get password/group file entry
- error
- All utils return exit with an exit code. Usually, the following scheme is used:
- extendedbigdecimal
- An arbitrary precision float that can also represent infinity, NaN, etc.
- fast_
inc - format
printf
-style formatting- fs
- Set of functions to manage regular files, special files, and links.
- fsext
- Set of functions to manage file systems
- fsxattr
- Set of functions to manage xattr on files and dirs
- io
- Encapsulates differences between OSs regarding the access to file handles / descriptors. This is useful when dealing with lower level stdin/stdout access.
- line_
ending - Provides consistent newline/zero terminator handling for
-z
/--zero
flags. - lines
- Iterate over lines, including the line ending character(s).
- locale
- mode
- Set of functions to parse modes
- os
- Test if the program is running under WSL ref: https://github.com/microsoft/WSL/issues/4555 @@ https://archive.is/dP0bz
- panic
- Custom panic hooks that allow silencing certain types of errors.
- parser
- perms
- Common functions to manage permissions
- pipes
- Thin pipe-related wrappers around functions from the
nix
crate. - posix
- Iterate over lines, including the line ending character(s).
- process
- quoting_
style - Set of functions for escaping names according to different quoting styles.
- ranges
- A module for handling ranges of values.
- ringbuffer
- A fixed-size ring buffer.
- selinux
- Set of functions to manage SELinux security contexts
- signals
- This module provides a way to handle signals in a platform-independent way. It provides a way to convert signal names to their corresponding values and vice versa. It also provides a way to ignore the SIGINT signal and enable pipe errors.
- sum
- Implementations of digest functions, like md5 and sha1.
- update_
control - Implement GNU-style update functionality.
- uptime
- Provides functions to get system uptime, number of users and load average.
- utmpx
- Aims to provide platform-independent methods to obtain login records
- version_
cmp - Compare two version strings.
Macros§
- bin
- Execute utility code for
util
. - crate_
version - Generate the version string for clap.
- has
- Used to check if the
mode
has itsperm
bit set. - help_
about - Get the about text from the help file.
- help_
section - Reads a section from a file of the util as a
str
literal. - help_
usage - Get the usage from the help file.
- prompt_
yes - Prompt the user with a formatted string and returns
true
if they reply'y'
or'Y'
- show
- Display a
crate::error::UError
and set global exit code. - show_
error - Show an error to stderr in a similar style to GNU coreutils.
- show_
if_ err - Display an error and set global exit code in error case.
- show_
warning - Print a warning message to stderr.
- show_
warning_ caps - Print a warning message to stderr, prepending the utility name.
- uio_
error - Shorthand to construct
UIoError
-instances.
Traits§
- Args
- Args contains arguments passed to the utility.
It is a trait that extends
Iterator<Item = OsString>
. It provides utility functions to collect the arguments into aVec<String>
. The collectedVec<String>
can be lossy or ignore invalid encoding.
Functions§
- args_os
- Returns an iterator over the command line arguments as
OsString
s. args_os() can be expensive to call - disable_
rust_ signal_ handlers - Disables the custom signal handlers installed by Rust for stack-overflow handling. With those custom signal handlers processes ignore the first SIGBUS and SIGSEGV signal they receive. See https://github.com/rust-lang/rust/blob/8ac1525e091d3db28e67adcbbd6db1e1deaa37fb/src/libstd/sys/unix/stack_overflow.rs#L71-L92 for details.
- execution_
phrase - Derive the complete execution phrase for “usage”.
- format_
usage - Generate the usage string for clap.
- get_
utility_ is_ second_ arg - Used to check if the utility is the second argument.
Used to check if we were called as a multicall binary (
coreutils <utility>
) - os_
str_ as_ bytes - Converts an
OsStr
to a UTF-8&[u8]
. - os_
str_ as_ bytes_ lossy - Performs a potentially lossy conversion from
OsStr
to UTF-8 bytes. - os_
str_ from_ bytes - Converts a
&[u8]
to an&OsStr
, or parses it as UTF-8 into anOsString
on non-unix platforms. - os_
string_ from_ vec - Converts a
Vec<u8>
into anOsString
, parsing as UTF-8 on non-unix platforms. - read_
byte_ lines - Equivalent to
std::BufRead::lines
which outputs each line as aVec<u8>
, which avoids panicking on non UTF-8 input. - read_
os_ string_ lines - Equivalent to
std::BufRead::lines
which outputs each line as anOsString
This won’t panic on non UTF-8 characters on Unix, but it still will on Windows. - read_
yes - Read a line from stdin and check whether the first character is
'y'
or'Y'
- set_
utility_ is_ second_ arg - Change the value of
UTILITY_IS_SECOND_ARG
to true Used to specify that the utility is the second argument. - util_
name - Derive the utility name.
Attribute Macros§
- main
- A procedural macro to define the main function of a uutils binary.