A collection of examples demonstrating various tools in the dir-structure-tools crate.
- clean_dir.rs: An example demonstrating the use of
CleanDirto ensure a directory is clean before writing.
- json.rs: An example demonstrating the use of
Jsonto read and write JSON files. - json_pretty.rs: An example demonstrating the use of
JsonPrettyto read and write pretty-printed JSON files. - toml.rs: An example demonstrating the use of
Tomlto read and write TOML files. - yaml.rs: An example demonstrating the use of
Yamlto read and write YAML files. - ron.rs: An example demonstrating the use of
Ronto read and write RON files. - ron_pretty.rs: An example demonstrating the use of
RonPrettyto read and write pretty-printed RON files.
The examples above demonstrate the basic usage of the dir-structure crate with the default synchronous VFS (StdFsVfs). While
98% of use-cases can be covered with just those basic usage patterns, the crate also supports more advanced features, which are
demonstrated in the examples below.
Important
A warning first: In order to understand the examples below, it is recommended to read the documentation for the
dir_structure::traits::vfs module first.
- deferred_read.rs: An example demonstrating the use of
DeferredReadto defer reading file contents until they are needed.
- deferred_read_or_own.rs: An example demonstrating the use of
DeferredReadOrOwnto defer reading file contents and cache them.
- reading_dir_children.rs: An example demonstrating the use of
DirChildrento read dynamic directory contents. - writing_dir_children.rs: An example demonstrating the use of
DirChildrento write dynamic directory contents.