Skip to content

Use NonNull in as_ptr and into_raw#23

Merged
madsmtm merged 1 commit intomasterfrom
nonnull
Sep 9, 2024
Merged

Use NonNull in as_ptr and into_raw#23
madsmtm merged 1 commit intomasterfrom
nonnull

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
@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