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
1212
1313This crate provides the following derive macros:
1414
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).
1616
1717### The SafeDebug derive macro
1818
@@ -31,11 +31,23 @@ struct Credentials {
3131 pub username : String ,
3232 pub password : String ,
3333};
34- let credentials : Credentials = Credentials {
34+
35+ let credentials = Credentials {
3536 username : " admin" . into (),
3637 password : " hunter2" . into (),
3738};
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+ );
3951```
4052
4153## Contributing
You can’t perform that action at this time.
0 commit comments