summaryrefslogtreecommitdiffstats
path: root/tokio/tests
diff options
context:
space:
mode:
authorJohn-John Tedro <udoprog@tedro.se>2020-08-26 20:50:35 +0200
committerGitHub <noreply@github.com>2020-08-26 20:50:35 +0200
commit2e7e42bca78790e6b7a848445db47de77bfcd8af (patch)
tree207ada777bda2eb9f7db2afa090a99d4e6d84d57 /tokio/tests
parent0ccc09ac92c17ca81a2fd19fe7c7fe4c00e40c30 (diff)
sync: implement map methods of parking_lot fame (#2445)
Generally, this mimics the way `MappedRwLock*Guard`s are implemented in `parking_lot`. By storing a raw pointer in the guards themselves referencing the mapped data and maintaining type invariants through `PhantomData`. I didn't try to think too much about this, so if someone has objections I'd love to hear them. I've also dropped the internal use of `ReleasingPermit`, since it made the guards unecessarily large. The number of permits that need to be released are already known by the guards themselves, and is instead governed directly in the relevant `Drop` impls. This has the benefit of making the guards as small as possible, for the non-mapped variants this means a single reference is enough. `fmt::Debug` impls have been adjusted to behave exactly like the delegating impls in `parking_lot`. `fmt::Display` impls have been added for all guard types which behave the same. This does change the format of debug impls, for which I'm not sure if we provide any guarantees.
Diffstat (limited to 'tokio/tests')
0 files changed, 0 insertions, 0 deletions