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

Consider sealing ArrowNativeType #1028

Closed
alamb opened this issue Dec 11, 2021 · 0 comments · Fixed by #1819
Closed

Consider sealing ArrowNativeType #1028

alamb opened this issue Dec 11, 2021 · 0 comments · Fixed by #1819
Labels
enhancement Any new improvement worthy of a entry in the changelog

Comments

@alamb
Copy link
Contributor

alamb commented Dec 11, 2021

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

The comments for Buffer::typed_data make the following point

    /// `ArrowNativeType` is public so that it can be used as a trait bound for other public
    /// components, such as the `ToByteSlice` trait.  However, this means that it can be
    /// implemented by user defined types, which it is not intended for.

Meaning that if some user crate implements ArrowNativeType for another type, using Buffer::typed_data (and others) will result in undefined behavior.

Describe the solution you'd like
Ensure users of the arrow crate can not impl ArrowNativeType

One way to do this would be to follow the sealed trait pattern here: https://rust-lang.github.io/api-guidelines/future-proofing.html

Additional context
This is extracted from a discussion with @jhorstmann on #996 (comment)

@alamb alamb added the enhancement Any new improvement worthy of a entry in the changelog label Dec 11, 2021
tustvold added a commit to tustvold/arrow-rs that referenced this issue Jun 8, 2022
tustvold added a commit that referenced this issue Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant