I'm currently working with GLUT bindings in Rust (or I can use GLFW,
doesn't matter to me), and one of the main ways that GLUT (and GLFW)
manage things such as key presses is with callback functions. Getting
a Rust function to act as a callback function for GLUT is easy enough,
but I'm currently stuck at figuring out how I'm supposed to manipulate
the world state when input happens, or when a frame "ticks", etc.

Due to the nature of Rust, just throwing an anonymous function into
the callback doesn't work by itself, because impure functions might be
used with an @WorldState (thus it doesn't compile), or moving a
~WorldState can only work once, and not into the 5+ callbacks I need
to setup.

How can I properly work with GLUT such that each callback can
manipulate the WorldState in some way? (preferably safely)



_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to