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

Use NonNull in as_ptr and into_raw #23

Merged
merged 1 commit into from
Sep 9, 2024
Merged

Use NonNull in as_ptr and into_raw #23

merged 1 commit into from
Sep 9, 2024

Conversation

madsmtm
Copy link
Member

@madsmtm madsmtm commented Sep 9, 2024

We already use NonNull in our public API in the creation methods, let's also use it when yielding back the value.

This differs from std's Box methods, but I think that's fine, std's methods are from before NonNull was introduced.

@madsmtm madsmtm added the enhancement New feature or request label Sep 9, 2024
@madsmtm madsmtm merged commit 8cb241c into master Sep 9, 2024
4 checks passed
@madsmtm madsmtm deleted the nonnull branch September 9, 2024 11:43
@madsmtm madsmtm mentioned this pull request Sep 9, 2024
Comment on lines +256 to +257
// Unwrap is fine, `Retained` stores a non-null pointer
NonNull::new(Retained::into_raw(self.layer).cast()).unwrap()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing (given your PR description here about Box) that you might plan on changing the return type of Retained too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm considering it

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

Successfully merging this pull request may close these issues.

2 participants