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

[Ref] Make methods into associated functions #1618

Merged
merged 1 commit into from
Sep 8, 2024
Merged

[Ref] Make methods into associated functions #1618

merged 1 commit into from
Sep 8, 2024

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Sep 7, 2024

Since Ref implements Deref, methods risk conflicting with methods of the same names on the target type.

Note that, in #210, we considered applying the same change to Unalign. We choose not to do that because most uses of Unalign involve types with alignments greater than 1, and for these types, Unalign does not implement Deref. It's not worth making the API significantly more cumbersome in order to make it easier for this niche use case.

Closes #210

Since `Ref` implements `Deref`, methods risk conflicting with methods of
the same names on the target type.

Note that, in #210, we considered applying the same change to `Unalign`.
We choose not to do that because most uses of `Unalign` involve types
with alignments greater than 1, and for these types, `Unalign` does not
implement `Deref`. It's not worth making the API significantly more
cumbersome in order to make it easier for this niche use case.

Closes #210
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.83%. Comparing base (403a890) to head (8cd0903).

Files with missing lines Patch % Lines
src/deprecated.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1618   +/-   ##
=======================================
  Coverage   87.83%   87.83%           
=======================================
  Files          15       15           
  Lines        5623     5623           
=======================================
  Hits         4939     4939           
  Misses        684      684           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Merged via the queue into main with commit 1f9ee92 Sep 8, 2024
74 checks passed
@joshlf joshlf deleted the deref-methods branch September 8, 2024 00:20
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.

For types which implement Deref, change some methods to associated functions?
3 participants