Module rust_utils::utils[][src]

Functions

alphabetize

Alphabetizes a vector of strings

capitalize

Capitalize the first letter in a string

concat_strDeprecated

Concatenates (joins) 2 or more strings in a vector together

find_char

Returns the location (starting from 0) of the first instance of a character in a string Skips any leading digits Useful for parsing arguments Returns the string’s length if the char is not found

get_dir

Returns a list of files/directories using path string

get_execname

Get the name of the executable

get_filename

Get the name of the file/directory from a file path

get_parent

Gets the parent directory from a file path

get_shared_val

Gets a shared value (temp file in /tmp or .cache) Value must be a string value

make_dir

Creates directory (and any parents) and handles any errors that may occur Returns the following codes: OK: Successfully created the directory and its parents ERR: Unable to create the directory

read_file

Abstraction around fs::read_to_string() that includes error handling Returns the file content as a String or returns “ERR” if something went wrong

save_file

Abstraction around fs::write() that includes error handling Returns the following codes: OK: Save operation successful ERR: There was a problem writing the file

set_shared_val

Saves a string to a shared value (temp file in /tmp or ~/.cache) Value must be a string value