DataDog / glommio

Glommio is a thread-per-core crate that makes writing highly parallel asynchronous applications in a thread-per-core architecture easier for rustaceans.
Other
3.06k stars 162 forks source link

Implement a weak reference to a DmaFile #658

Closed vlovich closed 5 months ago

vlovich commented 5 months ago

What does this PR do?

Introduces WeakDmaFile to be able to construct a non-owning reference that can be upgraded to an owning one.

Motivation

When I went to migrate my current usage of wrapping DmaFile with Rc, I realized there's a spot I use weak Rc. So instead of having a weird pattern of Rc over something using Arc internally, it would be nice to use a proper weak reference to the DmaFile.

Related issues

646

Additional Notes

Checklist

[X] I have added unit tests to the code I am submitting [X] My unit tests cover both failure and success scenarios [] If applicable, I have discussed my architecture

glommer commented 5 months ago

I don't see a problem with this pattern. But tests failing =(

vlovich commented 5 months ago

I haven't incorporated running clippy into my muscle memory. Should start doing that on my project. Fixed.

vlovich commented 5 months ago

Fixed my vscode settings for this project so hopefully won't come up again (clippy run by rust-analyzer & highlights problems inline on save).