I disagree. Not all Rust code needs to be maximally generalized and reusable. If this were library code, I might feel differently. But here we're looking at code for installing a global, system-wide keyboard hook. Using a global variable is a direct, pragmatic, no-nonsense way of doing it.
Edit: Further, there's no such thing as "the purpose of using Rust". Different users can use the same tool for different purposes, and Rust is no different.