-
pub trait Value: crate::sealed::Sealed {
/// Visits this value with the given `Visitor`.
fn record(&self, key: &Field, visitor: &mut dyn Visit);
}
mod sealed {
pub trait Sealed {}
} I don't see a solution to implement Value in application code. I can see that it is possible using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
However, the trait must be used in user code. Therefore, it has to be |
Beta Was this translation helpful? Give feedback.
Value
is not intended to be implemented in user code, that's why it'sSealed
. 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 implementValue
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 withSealed
allow traits to be used publicly while preventing downstream implementations. See https://rust-lang.github.io/api-guidelines/…