Crate uucore

Source
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’s fs::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 its perm 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 a Vec<String>. The collected Vec<String> can be lossy or ignore invalid encoding.

Functions§

args_os
Returns an iterator over the command line arguments as OsStrings. 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 an OsString on non-unix platforms.
os_string_from_vec
Converts a Vec<u8> into an OsString, parsing as UTF-8 on non-unix platforms.
read_byte_lines
Equivalent to std::BufRead::lines which outputs each line as a Vec<u8>, which avoids panicking on non UTF-8 input.
read_os_string_lines
Equivalent to std::BufRead::lines which outputs each line as an OsString 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.