Skip to content

Commit 6468e55

Browse files
committed
add struct example
1 parent a561b19 commit 6468e55

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "redact"
3-
version = "0.0.4"
3+
version = "0.0.5"
44
authors = ["Ethan Brierley <ethanboxx@gmail.com>"]
55
license = "MIT/Apache-2.0"
66
readme = "README.md"

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ assert_eq!("hello world", *encryption_key.expose_secret())
2828
The `Secret` type doubles as a useful documentation tool.
2929
Documenting values mantainers should be careful with.
3030

31+
```rust,ignore
32+
#[derive(Debug)] // Safe since Debug is not able to "see" our `Secret`s
33+
struct Payment {
34+
// The recipient is PII so we don't want it to appear in logs
35+
recipient: Secret<String>,
36+
// It's okay for the amount to appear in logs so we don't mark it with `Secret`
37+
amount: u64,
38+
}
39+
```
40+
3141
## Comparison with alternatives
3242

3343
### [secrecy](https://docs.rs/secrecy/latest/secrecy/)

0 commit comments

Comments
 (0)