File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
sdk/typespec/typespec_macros Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ The TypeSpec Macros crate provides procedural macros for [TypeSpec](https://type
12
12
13
13
This crate provides the following derive macros:
14
14
15
- - ` SafeDebug ` : A derive macro that implements debug formatting in a way that avoids leaking personally identifiable information (PII).
15
+ - ` SafeDebug ` : A derive macro that implements debug formatting in a way that avoids leaking personally identifiable information (PII).
16
16
17
17
### The SafeDebug derive macro
18
18
@@ -31,11 +31,23 @@ struct Credentials {
31
31
pub username : String ,
32
32
pub password : String ,
33
33
};
34
- let credentials : Credentials = Credentials {
34
+
35
+ let credentials = Credentials {
35
36
username : " admin" . into (),
36
37
password : " hunter2" . into (),
37
38
};
38
- println! (" {credentials:?}" );
39
+
40
+ #[cfg(not(feature = " debug" ))]
41
+ assert_eq! (
42
+ format! (" {credentials:?}" ),
43
+ r # " Credentials { username: "admin", .. }" # ,
44
+ );
45
+
46
+ #[cfg(feature = " debug" )]
47
+ assert_eq! (
48
+ format! (" {credentials:?}" ),
49
+ r # " Credentials { username: "admin", password: "hunter2" }" # ,
50
+ );
39
51
```
40
52
41
53
## Contributing
You can’t perform that action at this time.
0 commit comments