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

change ref to in and use Unsafe.AsRef #1247

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

bollhals
Copy link
Contributor

@bollhals bollhals commented Sep 7, 2022

Proposed Changes

This change avoids having to expose the ref BasicProperties parameter we have introduced when switching over to the struct BasicProperties.

Ref has 2 downsides,

    1. it's not readonly, so the user could think we're editing the struct, which we do not want to do.
    1. you have to put ref infront of it everywhere

This PR changes it to be in, and in the lowest possible place use Unsafe.AsRef to cheat our way to be able to use ref for the SerializeToFrames method.
(Which requires it, as the generic method creates defensive copies of the struct if it is n for each method call, as it is not aware that the method itself is readonly due to the interface description not allowing to mark a method as readonly. (This is a dotnet limitation))

So with this we get the best for the user and an acceptable workaround within the library.

Undos commit af8c072 of #1096

Types of Changes

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

@lukebakken
Copy link
Contributor

Thank you!

@lukebakken lukebakken merged commit 99a2b69 into rabbitmq:main Sep 22, 2022
@lukebakken lukebakken added this to the 7.0.0 milestone Sep 22, 2022
@lukebakken lukebakken self-assigned this Sep 22, 2022
@bollhals bollhals deleted the avoidRefInBasicPublish branch September 26, 2022 22:16
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