Skip to content
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

Implement a weak reference to a DmaFile #658

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

vlovich
Copy link
Contributor

@vlovich vlovich commented Apr 24, 2024

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
Copy link
Collaborator

glommer commented Apr 24, 2024

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

@vlovich
Copy link
Contributor Author

vlovich commented Apr 24, 2024

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

@vlovich
Copy link
Contributor Author

vlovich commented Apr 24, 2024

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

@glommer glommer merged commit eea418d into DataDog:master Apr 25, 2024
5 checks passed
@vlovich vlovich deleted the weak-dma-file branch April 25, 2024 18:24
@vlovich vlovich restored the weak-dma-file branch May 1, 2024 14:24
@vlovich vlovich deleted the weak-dma-file branch May 1, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants