use std::time::Duration;
use lazy_static::lazy_static;
use crate::{iterators::RetrieveAllRef, Bus, Message};
lazy_static! {
static ref BUS: Bus = Bus::new();
}
pub fn push<T>(message_data: T)
where
T: 'static + Send,
{
BUS.push(message_data);
}
pub fn retrieve_all<T>() -> RetrieveAllRef<'static, T>
where
T: 'static + Send,
{
BUS.retrieve_all()
}
pub fn wait_for_timeout<T>(timeout: Duration) -> Option<Message<'static, T>>
where
T: 'static + Send,
{
BUS.wait_for_timeout(timeout)
}
pub fn wait_for<T>() -> Message<'static, T>
where
T: 'static + Send,
{
BUS.wait_for()
}