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: README.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
3
3
Derive `Debug` with a custom format per field.
4
4
5
-
# Usage
5
+
# Example usage
6
6
7
-
Here is a showcase of all possible field attributes:
7
+
Here is a showcase of `custom_debug`s features:
8
8
9
9
```rust
10
10
usecustom_debug::Debug;
@@ -34,4 +34,22 @@ Foo {
34
34
x: 42 things,
35
35
z: 0xAB
36
36
}
37
-
```
37
+
```
38
+
39
+
# Field attributes reference
40
+
41
+
Attributes within a section below are considered mutually exclusive.
42
+
43
+
## Skip attributes
44
+
45
+
|||
46
+
|-|-|
47
+
|`skip`| Unconditionally skips a field. |
48
+
|`skip_if = path::to::function`| Skips a field if `path::to::function(&field)` returns `true`. |
49
+
50
+
## Format attributes
51
+
52
+
|||
53
+
|-|-|
54
+
|`format = "format string {}"`| Formats a field using a format string. Must contain a placeholder (`{}`) with modifiers of your choice. |
55
+
|`with = path::to::formatter`| Formats a field using `path::to::formatter`. The required signature is `fn(&T, &mut std::fmt::Formatter) -> std::fmt::Result` where `T` is a type compatible with the field's type (i.e. the function can be generic and coercions apply). |
0 commit comments