Skip to content

Why Value is pub while its bound Sealed is sealed? #1455

Answered by hawkw
tisonkun asked this question in Q&A
Discussion options

You must be logged in to vote

Value is not intended to be implemented in user code, that's why it's Sealed. It's only implemented for certain Rust primitive types. The intention is to replace the current value system with a more sophisticated implementation that allows user code to implement Value for arbitrary types, but this will require some significant changes to the trait. Until then, the trait has been sealed to prevent downstream implementations that would be broken by those changes.

However, the trait must be used in user code. Therefore, it has to be pub. pub traits bounded with Sealed allow traits to be used publicly while preventing downstream implementations. See https://rust-lang.github.io/api-guidelines/…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tisonkun
Comment options

Answer selected by tisonkun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1454 on July 01, 2021 17:01.