Skip to content

Commit d50d5cf

Browse files
committed
chore: fixes
1 parent 841a579 commit d50d5cf

File tree

10 files changed

+77
-49
lines changed

10 files changed

+77
-49
lines changed

.github/actions/test-dir-structure/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ runs:
1010
using: "composite"
1111
steps:
1212
- name: Run tests
13-
run: cargo test -p dir-structure ${{ inputs.feature-combos }} -- --test-threads=1
13+
run: cargo test ${{ inputs.feature-combos }} --workspace -- --test-threads=1
1414
shell: bash

.github/workflows/test-dir-structure.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ jobs:
121121
- name: Run feature-combo tests (--features assert_eq,include_dir)
122122
uses: ./.github/actions/test-dir-structure
123123
with: { feature-combos: "--features assert_eq,include_dir" }
124-
- name: Run feature-combo tests (--no-default-features --features tools-atomic-dir)
124+
- name: Run feature-combo tests (--no-default-features --features atomic-dir)
125125
uses: ./.github/actions/test-dir-structure
126-
with: { feature-combos: "--no-default-features --features tools-atomic-dir" }
127-
- name: Run feature-combo tests (--no-default-features --features tools-atomic-dir,async)
126+
with: { feature-combos: "--no-default-features --features atomic-dir" }
127+
- name: Run feature-combo tests (--no-default-features --features atomic-dir,async)
128128
uses: ./.github/actions/test-dir-structure
129-
with: { feature-combos: "--no-default-features --features tools-atomic-dir,async" }
130-
- name: Run feature-combo tests (--no-default-features --features tools-atomic-dir,async,tokio)
129+
with: { feature-combos: "--no-default-features --features atomic-dir,async" }
130+
- name: Run feature-combo tests (--no-default-features --features atomic-dir,async,tokio)
131131
uses: ./.github/actions/test-dir-structure
132-
with: { feature-combos: "--no-default-features --features tools-atomic-dir,async,tokio" }
132+
with: { feature-combos: "--no-default-features --features atomic-dir,async,tokio" }

dir-structure-tools/Cargo.toml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,6 @@ name = "writing_to_tokio_fs_vfs"
158158
path = "examples/writing_to_tokio_fs_vfs.rs"
159159
required-features = ["tokio", "async", "derive"]
160160

161-
[[example]]
162-
name = "resolve_path"
163-
path = "examples/resolve_path.rs"
164-
required-features = ["resolve-path", "derive"]
165-
166-
[[example]]
167-
name = "load_path"
168-
path = "examples/load_path.rs"
169-
required-features = ["resolve-path", "derive"]
170-
171161
[[example]]
172162
name = "std_fs_vfs"
173163
path = "examples/std_fs_vfs.rs"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# `dir-structure-tools` examples
2+
3+
A collection of examples demonstrating various tools in the `dir-structure-tools` crate.
4+
5+
## `CleanDir`
6+
7+
- [clean_dir.rs](clean_dir.rs): An example demonstrating the use of `CleanDir` to ensure a directory is clean before writing.
8+
9+
## `data_formats::*`
10+
11+
- [json.rs](json.rs): An example demonstrating the use of `Json` to read and write JSON files.
12+
- [json_pretty.rs](json_pretty.rs): An example demonstrating the use of `JsonPretty` to read and write pretty-printed JSON files.
13+
- [toml.rs](toml.rs): An example demonstrating the use of `Toml` to read and write TOML files.
14+
- [yaml.rs](yaml.rs): An example demonstrating the use of `Yaml` to read and write YAML files.
15+
- [ron.rs](ron.rs): An example demonstrating the use of `Ron` to read and write RON files.
16+
- [ron_pretty.rs](ron_pretty.rs): An example demonstrating the use of `RonPretty` to read and write pretty-printed RON files.
17+
18+
## A note on the following examples
19+
20+
The examples above demonstrate the basic usage of the `dir-structure` crate with the default synchronous VFS (`StdFsVfs`). While
21+
98% of use-cases can be covered with just those basic usage patterns, the crate also supports more advanced features, which are
22+
demonstrated in the examples below.
23+
24+
> [!IMPORTANT]
25+
> A warning first: In order to understand the examples below, it is recommended to read the documentation for the
26+
> [`dir_structure::traits::vfs` module](../../dir-structure/src/traits/vfs.rs) first.
27+
28+
## `DeferredRead`
29+
30+
- [deferred_read.rs](deferred_read.rs): An example demonstrating the use of `DeferredRead` to defer reading file contents until they are needed.
31+
32+
## `DeferredReadOrOwn`
33+
34+
- [deferred_read_or_own.rs](deferred_read_or_own.rs): An example demonstrating the use of `DeferredReadOrOwn` to defer reading file contents and cache them.
35+
36+
## `DirChildren`
37+
38+
- [reading_dir_children.rs](reading_dir_children.rs): An example demonstrating the use of `DirChildren` to read dynamic directory contents.
39+
- [writing_dir_children.rs](writing_dir_children.rs): An example demonstrating the use of `DirChildren` to write dynamic directory contents.

dir-structure/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,23 @@ git2 = { workspace = true, optional = true }
138138

139139
[lints]
140140
workspace = true
141+
142+
[[example]]
143+
name = "reading_from_tokio_fs_vfs"
144+
path = "examples/reading_from_tokio_fs_vfs.rs"
145+
required-features = ["tokio", "async", "derive"]
146+
147+
[[example]]
148+
name = "writing_to_tokio_fs_vfs"
149+
path = "examples/writing_to_tokio_fs_vfs.rs"
150+
required-features = ["tokio", "async", "derive"]
151+
152+
[[example]]
153+
name = "resolve_path"
154+
path = "examples/resolve_path.rs"
155+
required-features = ["resolve-path", "derive"]
156+
157+
[[example]]
158+
name = "load_path"
159+
path = "examples/load_path.rs"
160+
required-features = ["resolve-path", "derive"]

dir-structure/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../README.md

dir-structure/examples/README.md

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ A collection of examples demonstrating various features of the `dir-structure` c
77
- [reading.rs](reading.rs): A simple example of reading a directory structure from disk.
88
- [writing.rs](writing.rs): A simple example of writing a directory structure to disk.
99

10-
## `CleanDir`
10+
## `resolve_path`
11+
12+
- [resolve_path.rs](resolve_path.rs): An example demonstrating the use of `resolve_path` to resolve paths within a directory structure.
13+
14+
## `load_path`
1115

12-
- [clean_dir.rs](clean_dir.rs): An example demonstrating the use of `CleanDir` to ensure a directory is clean before writing.
16+
- [load_path.rs](load_path.rs): An example demonstrating the use of `load_path` to load a specific file from a path within a directory structure, without loading the entire structure.
1317

14-
## `data_formats::*`
18+
## `dir-structure-tools`
1519

16-
- [json.rs](json.rs): An example demonstrating the use of `Json` to read and write JSON files.
17-
- [json_pretty.rs](json_pretty.rs): An example demonstrating the use of `JsonPretty` to read and write pretty-printed JSON files.
18-
- [toml.rs](toml.rs): An example demonstrating the use of `Toml` to read and write TOML files.
19-
- [yaml.rs](yaml.rs): An example demonstrating the use of `Yaml` to read and write YAML files.
20-
- [ron.rs](ron.rs): An example demonstrating the use of `Ron` to read and write RON files.
21-
- [ron_pretty.rs](ron_pretty.rs): An example demonstrating the use of `RonPretty` to read and write pretty-printed RON files.
20+
Also see [the examples in the `dir-structure-tools` crate](../../dir-structure-tools/examples/), which demonstrate more advanced features of the `dir-structure` crate.
2221

2322
## A note on the following examples
2423

@@ -30,19 +29,6 @@ demonstrated in the examples below.
3029
> A warning first: In order to understand the examples below, it is recommended to read the documentation for the
3130
> [`dir_structure::traits::vfs` module](../src/traits/vfs.rs) first.
3231
33-
## `DeferredRead`
34-
35-
- [deferred_read.rs](deferred_read.rs): An example demonstrating the use of `DeferredRead` to defer reading file contents until they are needed.
36-
37-
## `DeferredReadOrOwn`
38-
39-
- [deferred_read_or_own.rs](deferred_read_or_own.rs): An example demonstrating the use of `DeferredReadOrOwn` to defer reading file contents and cache them.
40-
41-
## `DirChildren`
42-
43-
- [reading_dir_children.rs](reading_dir_children.rs): An example demonstrating the use of `DirChildren` to read dynamic directory contents.
44-
- [writing_dir_children.rs](writing_dir_children.rs): An example demonstrating the use of `DirChildren` to write dynamic directory contents.
45-
4632
## Virtual File Systems (VFS)
4733

4834
### Library-provided synchronous VFS implementations
@@ -51,7 +37,7 @@ demonstrated in the examples below.
5137

5238
- [std_fs_vfs.rs](std_fs_vfs.rs): An example of reading / writing a directory structure from the actual file system using the `StdFsVfs`. Note that this is the default VFS used by `DirStructureItem::read` and `DirStructureItem::write`, so all the examples listed above use this VFS implicitly. This example is just to demonstrate the explicit use of the `StdFsVfs`.
5339

54-
#### `include_dir` VFS
40+
<!-- #### `include_dir` VFS
5541
5642
- [reading_from_include_dir_vfs.rs](reading_from_include_dir_vfs.rs): An example of reading a directory structure from an embedded file system using the `include_dir_vfs!` macro.
5743
- [reading_dir_children_from_include_dir_vfs.rs](reading_dir_children_from_include_dir_vfs.rs): An example demonstrating the use of `DirChildren` to read dynamic directory contents from an embedded file system using the `include_dir_vfs!` macro.
@@ -62,7 +48,7 @@ Note that the `include_dir` VFS is read-only, so there are no writing examples.
6248
6349
- [reading_from_git_vfs.rs](reading_from_git_vfs.rs): An example of reading a directory structure from a git repository.
6450
65-
Note that the `git` VFS is read-only, so there are no writing examples.
51+
Note that the `git` VFS is read-only, so there are no writing examples. -->
6652

6753
### Library-provided asynchronous VFS implementations
6854

@@ -71,11 +57,3 @@ Note that the `git` VFS is read-only, so there are no writing examples.
7157
- [reading_from_tokio_fs_vfs.rs](reading_from_tokio_fs_vfs.rs): An example of reading a directory structure from the actual file system using `TokioFsVfs`.
7258
- [writing_to_tokio_fs_vfs.rs](writing_to_tokio_fs_vfs.rs): An example of writing a directory structure to the actual file system using `TokioFsVfs`.
7359

74-
75-
## `resolve_path`
76-
77-
- [resolve_path.rs](resolve_path.rs): An example demonstrating the use of `resolve_path` to resolve paths within a directory structure.
78-
79-
## `load_path`
80-
81-
- [load_path.rs](load_path.rs): An example demonstrating the use of `load_path` to load a specific file from a path within a directory structure, without loading the entire structure.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)