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

Make RenderElement implementations generic to reduce duplication #682

Merged
merged 1 commit into from
Aug 5, 2024

Commits on Aug 5, 2024

  1. Make RenderElement implementations generic to reduce duplication

    It would make sense to have a bound like
    `for<'frame> R::Frame<'frame>: AsGlowFrame<'frame>`. But that appears to
    not behave properly due to current limitations of the borrow checker:
    https://blog.rust-lang.org/2022/10/28/gats-stabilization.html#implied-static-requirement-from-higher-ranked-trait-bounds
    
    Instead, this makes `glow_frame` and `glow_frame_mut` associated
    functions of the `AsGlowRenderer` trait. Then it is pretty
    straightforward to make the `RenderElement` implementations generic
    using that and `FromGlesError`.
    
    It would make sense to make `Self::Error: FromGlessError` a requirement
    of the `AsGlowRenderer` trait, but due to the lack of implied bounds
    support, that produces a bunch of errors about missing bounds. If Rustc
    improves that eventually, some bounds could be cleaned up a bit:
    rust-lang/rust#44491
    ids1024 committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    ccc91c2 View commit details
    Browse the repository at this point in the history