Function ambient_api_core::message::subscribe
source · pub fn subscribe<R: CallbackReturn, T: Message>(
callback: impl FnMut(MessageContext, T) -> R + 'static
) -> Listener
Expand description
Subscribes to a message.
To unsubscribe from a message, call Listener::stop on the returned Listener, or on the MessageContext that is passed to the callback.