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 Layer::into_raw #22

Merged
merged 1 commit into from
Sep 9, 2024
Merged

Add Layer::into_raw #22

merged 1 commit into from
Sep 9, 2024

Conversation

madsmtm
Copy link
Member

@madsmtm madsmtm commented Sep 4, 2024

Allow consuming the Layer, which allows avoiding an unnecessary retain/release in the fairly common case where the user was going to retain anyhow.

Draft because it builds upon #19.

@madsmtm madsmtm added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 4, 2024
@MarijnS95
Copy link
Member

I wish as_ptr() was named as_raw() in that case (and I have to do a similar refactor on the NDK 😩).

@madsmtm
Copy link
Member Author

madsmtm commented Sep 4, 2024

Hmm, maybe we call this into_ptr then instead? Idk., I don't care much for the naming, so I will leave that decision to you, but I will note that Box uses as_ptr and into_raw...

Base automatically changed from proper-layer-init to master September 9, 2024 11:18
@madsmtm madsmtm marked this pull request as ready for review September 9, 2024 11:21
@madsmtm
Copy link
Member Author

madsmtm commented Sep 9, 2024

I'm gonna go with into_raw, as I think it communicates more clearly "give up ownership of the pointer", though I will differ from std by returning NonNull instead, will do so in a later PR.

@madsmtm madsmtm merged commit 70e3f4d into master Sep 9, 2024
4 checks passed
@madsmtm madsmtm deleted the into_raw branch September 9, 2024 11:25
@MarijnS95
Copy link
Member

Idk either, it's already inconsistent in std anyway. Maybe I'll use this standard as a guide for the NDK though, which is currently incredibly mixed anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants