gregtatum / rugl

Declarative Stateless OpenGL in Rust
MIT License
40 stars 2 forks source link

Make `DrawBuilder` non-consuming #1

Open alteous opened 7 years ago

alteous commented 7 years ago

By taking &mut self instead of mut self, the user will be able to chain calls more ergonomically.

This pattern is recommended by the Rust API guidelines.

gregtatum commented 7 years ago

I think the reason why I didn't do this the first time was the impact to the user-facing API. It has a bit more overhead to consume the data, but that's initialization work not real-time work. Is there a way to do this without making the draw building API more verbose? I think I'd be OK with a small perf hit for some better developer ergonomics.