You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/colors.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,8 @@ Terminals use the same escape codes to support both colors and styles---bold, it
41
41
42
42
**Applications *must not* use blinking text.** Blinking text can be distracting or difficult to read for many people. The HTML `<blink>` tag, which had similar behavior, was [removed from web pages](https://www.fastcompany.com/3015408/saying-goodbye-to-the-html-tag) around 2013.
43
43
44
+
> TODO: add information about ASCII and Unicode symbols (including emoji) that are safe to use in terminals.
45
+
44
46
## ANSI color codes and Windows color APIs
45
47
46
48
Most Unix terminals support [ANSI color codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors). For example, turning the foreground color to "green" involves writing the characters `\x1b` (ESC), `[`, `32` (for green), and `m` to the terminal.
Copy file name to clipboardExpand all lines: src/hierarchical-config.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,9 +46,9 @@ Exactly how deep merges should go is application-specific.
46
46
47
47
There are two main Rust libraries for managing hierarchical configuration:
48
48
49
-
*[config](https://crates.io/crates/config). I've used this and it seems to work well.
50
-
*[figment](https://crates.io/crates/figment). This seems quite nice as well, though I haven't used it.
49
+
*[config](https://crates.io/crates/config). I've used this for my own projects.
50
+
*[figment](https://crates.io/crates/figment). Seems high quality, though I haven't used it.
51
51
52
-
These configuration libraries can be used in combination with serde, so that you can manage hierarchies and merges with dynamically typed variables at the edges of your program, then switch over to well-typed serde structures for the rest of your code. For how to do this with config, [see this example].
52
+
These configuration libraries can be used in combination with serde, so that you can manage hierarchies and merges with dynamically typed variables at the edges of your program, then switch over to well-typed serde structures for validating the config's schema. For how to do this with config, [see this example].
53
53
54
54
[see this example]: https://github.com/mehcode/config-rs/blob/53e43fbcf96b5c2a661d052a6e3d55fc3709f1e1/examples/hierarchical-env/settings.rs
* In general, you *should* keep lib.rs as minimal as possible, unless your entire library fits in it. That's
25
25
because all methods and fields in `lib.rs` are visible to the entire library---code in the top-level module
26
26
cannot be marked private to the rest of the module.
27
-
***There's a `lib.rs` separate from the `main.rs`.**
28
-
* This is because `rustdoc` doesn't use standard privacy rules if building documentation from `main.rs`,
29
-
so private modules are visible in the public documentation.
27
+
***There's a `lib.rs` separate from the `my-app.rs` that contains `main`.**
28
+
* There are several advantages to having a `lib.rs`. In particular, `rustdoc` doesn't use standard privacy rules if building documentation from `main.rs`, so private modules are visible in the public documentation.
30
29
***Only the top-level `MyApp` is exported.**
31
30
* The top-level `MyApp` is all `main.rs` should generally need to care about.
32
31
***`MyApp` is marked `#[doc(hidden)]`.**
33
32
* The details of `MyApp` are only meant to be seen by `main`. The library is not part of the public API. Only
34
33
the command-line interface is.
34
+
***`src/bin/my-app.rs` instead of `src/main.rs`.**
35
+
* While `src/main.rs` works just as well, `src/bin` makes it harder to accidentally import library code with `mod` statements.
Copy file name to clipboardExpand all lines: src/versioning.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,4 +14,4 @@ A binary crate *should* define its public API as consisting of the command-line
14
14
* Mark old commands or arguments deprecated, and possibly hide them from help text. Continue to preserve their behavior.
15
15
* If the program persists data on disk, make it possible to do forward transitions but not backward ones. Add a *format version* to persisted data and increment it every time the data format changes. If an old version of the program reads a format version it does not understand, error out gracefully.
16
16
17
-
> Tip: You can use the [baptiste0928/cargo-install](https://github.com/baptiste0928/cargo-install)Cargo action to install a binary from crates.io, caching it if possible. This action lets you specify a version range, which plays well with the above binary versioning policy.
17
+
> Tip: If you're using GitHub Actions for CI, use the [baptiste0928/cargo-install](https://github.com/baptiste0928/cargo-install) action to install a binary from crates.io, using a cached version if possible. This action lets you specify a version range, which plays well with the binary versioning policy above.
0 commit comments