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

Add free conversion from Bytes back to Arc if possible #217

Merged
merged 1 commit into from
May 30, 2024

Conversation

p-avital
Copy link
Contributor

The conversion is valid and free if:

  • The Bytes was constructed from an Arc (ensured by the vtable comparison)
  • The Arc was constructed in the same binary (ensured by the vtable comparison)
  • The Bytes' wasn't shrunk (ensured by checking the start pointer and length)

Handling failure is left explicit to avoid hiding the costly version of the operation (copy into a new Arc).

@danielhenrymantilla danielhenrymantilla changed the title Add free conversion from Bytes back to Arc if possible Add free conversion from Bytes back to Arc if possible May 30, 2024
@danielhenrymantilla danielhenrymantilla merged commit 8b7a8e0 into master May 30, 2024
110 checks passed
@danielhenrymantilla danielhenrymantilla deleted the pa/arc-tryfrom-bytes branch May 30, 2024 10:18
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