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

Implement HasContext for &impl HasContext #248

Open notgull opened 1 year ago

notgull commented 1 year ago

I have an API that takes a type generic over the HasContext trait. It would be nice if you could also pass in &Context, Rc<Context> and other types in this way.

grovesNL commented 11 months ago

What would the implementation look like?

notgull commented 11 months ago

It would probably be a macro that implements HasContext over Rc<T>, &T and others as methods that are just forwarded to the inner HasContext implementation.