grovesNL / glow

GL on Whatever: a set of bindings to run GL anywhere and avoid target-specific code
Apache License 2.0
1.17k stars 130 forks source link

Seal the HasContext trait #280

Closed notgull closed 7 months ago

notgull commented 7 months ago

In the current iteration of this crate, a new breaking change is needed every time a method is added to the HasContext trait. This is because a downstream crate could theoretically provide its own implementation of HasContext, and would need to accommodate for these new methods. However, most users of glow do not implement the HasContext trait and only act as consumers of it. This means that downstream crates have to constantly update glow to take advantage of new updates, which can be annoying.

This commit makes it so it is impossible to implement the HasContext trait outside of this crate. It does this by making a crate-private Sealed trait that is needed for implementors of HasContext. This makes it so methods can be freely added to HasContext without needing to release a new breaking version of glow.

The goal of this change is to make glow v1.0.0 possible. With this change it should be possible to release a stable API, assuming none of the other APIs need to be changed or removed in any way.

The downside of this change is that it becomes impossible to implement HasContext outside of this crate. I would be genuinely shocked if any such implementations existed

notgull commented 7 months ago

macOS failure appears to be a spurious network error

notgull commented 7 months ago

@grovesNL When do you think you'll be able to review this?