-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement Debug trait for sync variants of FrozenMap and FrozenVec #65
Conversation
- partially contributes to Manishearth#32, - Implements `Debug` trait for those structures where checking for reentrancy is straightforward.
6149511
to
666915e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't have the Debug impl print out map
etc; it's private, it should Debug
to the hashmap's debug impl directly (and then do the <locked>
thing when necessary)
@Manishearth Refactored, please let me know what you think. |
- Replaces the `debug_struct` method with straight `debug_map` for `FrozenMap` and `debug_list` for `FrozenVec` - Simplifies error handling by moving to `f.debug_tuple()` method instead of the previous `field()` calls based on `DebugStruct`
b325999
to
f2fac5b
Compare
src/sync.rs
Outdated
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match self.map.try_read() { | ||
Ok(guard) => { | ||
f.debug_map().entries(guard.iter()).finish() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just use guard.fmt(f)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Debug
trait for those structures where checking for reentrancy is straightforward.