Available on crate feature
fs only.Expand description
§File System Operations
Much of this is WIP and I will fill up this documentation in the future.
The general principle of this is cu::fs functions have tracing and error
context built-in
Modules§
- bin
- Binary path registry
Structs§
- Time
- A helper structure to represent a timestamp for a file.
- Walk
- An iterator over the entries of a directory walk.
- Walk
Builder - Builder for a directory
Walk, providing a simpler API over theignorecrate for the most common cases. - Walk
Entry - A single entry produced by a
Walk.
Functions§
- buf_
writer - Make a buffered writer to the file
- co_
make_ dir coroutine - Async version of
make_dir - co_
make_ dir_ absent_ or_ empty coroutine - Async version of
make_dir_absent_or_empty - co_
make_ dir_ empty coroutine - Async version of
make_dir_empty - co_read
coroutine - Async version of
read - co_
read_ dir coroutine - Async version of
read_dir - co_
read_ string coroutine - Async version of
read_string - co_
reader coroutine - Open a file for buffered asynchronous reading
- co_
rec_ remove coroutine - Async version of
rec_remove - co_
remove coroutine - Async version of
remove - co_
remove_ contents coroutine - Async version of
remove_contents. Note that this is not fail-fast. If some entry fails to delete, all entries will still be attempted to be deleted. - co_
write coroutine - Async version of
write - co_
write_ json coroutineandjson - Async version of
write_json. The serialization part is synchronous, since it does not involve IO. - co_
write_ json_ pretty coroutineandjson - Async version of
write_json_pretty. The serialization part is synchronous, since it does not involve IO. - co_
write_ toml coroutineandtoml - Async version of
write_toml. The serialization part is synchronous, since it does not involve IO. - co_
write_ toml_ pretty coroutineandtoml - Async version of
write_toml_pretty. The serialization part is synchronous, since it does not involve IO. - co_
write_ yaml coroutineandyaml - Async version of
write_yaml. The serialization part is synchronous, since it does not involve IO. - copy
- Copy a file from one to another.
- current_
exe std::env::current_exe()with error reporting- get_
mtime - Get the modified time for a file.
- is_
empty_ dir - Check if a directory exists and is empty.
- make_
dir - Ensure
pathexists and is a directory, creating it and all parent directories if not. - make_
dir_ absent_ or_ empty - Ensure
patheither does not exist, or is an empty directory. - make_
dir_ empty - Ensure
pathexists and is an empty directory. - read
std::fs::readwith tracing and error reporting- read_
dir std::fs::read_dirwith error reporting- read_
string std::fs::read_to_stringwith tracing and error reporting- reader
- Open a file for buffered reading
- rec_
copy_ inefficiently - (Inefficiently) recursively copy all files in
fromdirectory totodirectory. Old files intoare NOT removed if no corresponding file exists infrom. (If that behavior is desired, callcu::fs::make_dir_emptyorcu::fs::remove_contentsfirst) - rec_
remove - Recursively remove
pathand all of its contents. - remove
- Remove
pathas either a file or empty directory. - remove_
contents - Remove all of
path’s contents, but does not remove itself. - rename
- Move a file or directory.
- set_
mtime - Set the modified time for a file
- walk
- Recursively walk
rootwith default settings. - walker
- Create a walker to walk
rootrecursively. - write
- Writes the content to the path, automatically creating the directory if doesn’t exist.
- write_
json json - Serialize data as JSON and write it to a file.
- write_
json_ pretty json - Serialize data as JSON, prettified, and write it to a file.
- write_
toml toml - Serialize data as TOML and write it to a file.
- write_
toml_ pretty toml - Serialize data as TOML, prettified, and write it to a file.
- write_
yaml yaml - Serialize data as YAML and write it to a file.
- writer
- Make a non-buffered writer to the file