Skip to content

Conversation

petrosagg
Copy link
Contributor

The CapabilityTrait trait is part of the public API of timely (e.g OutputHandle::session expects one), but the trait itself is not publicly accessible.

This is because implementing this trait would circumvent the safety properties of capabilities. However, not exposing it also prevents safe wrapping of handles to provide additional functionality on top of them.

This PR offers a solution by making the capability module public and using the sealed trait
pattern
to prevent any foreign crate from implementing CapabilityTrait.

The `CapabilityTrait` trait is part of the public API of `timely` (e.g
`OutputHandle::session` expects one, but the trait itself is not
publicly accessible.

This is because implementing this trait would circumvent the safety
properties of capabilities. However, not exposing it also prevents safe
wrapping of handles to provide additional functionality on top of them.

This PR offers a solution by making the `capability` module public and
using the [sealed trait
pattern](https://rust-lang.github.io/api-guidelines/future-proofing.html)
to prevent any foreign crate from implementing `CapabilityTrait`.

Signed-off-by: Petros Angelatos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant