[−][src]Function ovrt_sys::cmd::sink::global_command_sink
pub fn global_command_sink(
may_set_listener: Option<Listener>
) -> &'static CommandSink
This function has two use-cases: getting the CommandSink
or
initializing it.
The "get it" usage is simple and is used internally by ovrt-sys to forward commands received from events/callbacks/etc.
The "initialize it" usage needs more elaboration:
The initialization occurs in the first global call to this
function. The caller may decide if a listener should be registered
(by passing Some
Listener
), otherwise, None
Listener
will
be registered.
Note: This None
Listener
will ignore all commands, but will at
least log them.
Note: to see if there is Some
registered listener, you may call the
has_listener
function on CommandSink
.
So with the exception of the first global call, all other remaining
calls should pass in None
as a listener parameter, since the
CommandSink
would already be initialized by the first global call.
Otherwise, if other calls are made passing a new Listener
as a
parameter, that parameter will simply be ignored and CommandSink
will
not change it's already registered Listener
(even if it's registered
as None
).