Skip to main content

Module fs

Module fs 

Source
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.
WalkBuilder
Builder for a directory Walk, providing a simpler API over the ignore crate for the most common cases.
WalkEntry
A single entry produced by a Walk.

Functions§

buf_writer
Make a buffered writer to the file
co_make_dircoroutine
Async version of make_dir
co_make_dir_absent_or_emptycoroutine
Async version of make_dir_absent_or_empty
co_make_dir_emptycoroutine
Async version of make_dir_empty
co_readcoroutine
Async version of read
co_read_dircoroutine
Async version of read_dir
co_read_stringcoroutine
Async version of read_string
co_readercoroutine
Open a file for buffered asynchronous reading
co_rec_removecoroutine
Async version of rec_remove
co_removecoroutine
Async version of remove
co_remove_contentscoroutine
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_writecoroutine
Async version of write
co_write_jsoncoroutine and json
Async version of write_json. The serialization part is synchronous, since it does not involve IO.
co_write_json_prettycoroutine and json
Async version of write_json_pretty. The serialization part is synchronous, since it does not involve IO.
co_write_tomlcoroutine and toml
Async version of write_toml. The serialization part is synchronous, since it does not involve IO.
co_write_toml_prettycoroutine and toml
Async version of write_toml_pretty. The serialization part is synchronous, since it does not involve IO.
co_write_yamlcoroutine and yaml
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 path exists and is a directory, creating it and all parent directories if not.
make_dir_absent_or_empty
Ensure path either does not exist, or is an empty directory.
make_dir_empty
Ensure path exists and is an empty directory.
read
std::fs::read with tracing and error reporting
read_dir
std::fs::read_dir with error reporting
read_string
std::fs::read_to_string with tracing and error reporting
reader
Open a file for buffered reading
rec_copy_inefficiently
(Inefficiently) recursively copy all files in from directory to to directory. Old files in to are NOT removed if no corresponding file exists in from. (If that behavior is desired, call cu::fs::make_dir_empty or cu::fs::remove_contents first)
rec_remove
Recursively remove path and all of its contents.
remove
Remove path as 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 root with default settings.
walker
Create a walker to walk root recursively.
write
Writes the content to the path, automatically creating the directory if doesn’t exist.
write_jsonjson
Serialize data as JSON and write it to a file.
write_json_prettyjson
Serialize data as JSON, prettified, and write it to a file.
write_tomltoml
Serialize data as TOML and write it to a file.
write_toml_prettytoml
Serialize data as TOML, prettified, and write it to a file.
write_yamlyaml
Serialize data as YAML and write it to a file.
writer
Make a non-buffered writer to the file

Type Aliases§

BufFile
CoDirEntrycoroutine
CoReadDircoroutine
CoReadercoroutine
A buffered async file reader
DirEntry
ReadDir
Reader
A buffered file reader