1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
pub mod actor;
pub mod queue;
pub use actor::Actor;
pub use queue::AQueue;
/// inner call wait ms throw time error
/// need on feature "tokio_time" or "async_std_time"
/// # tokio runtime:
/// ``` toml
/// aqueue = { version = "^1.2.10", features = ["tokio_time"] }
/// ```
/// # Example
/// ``` ignore
/// async fn test_unsafe_blocking(&self, name: String, gold: f64) -> Result<bool> {
/// inner_wait!(self, 30000, |_| async move { DB.insert_user(name, gold).await }).await?
/// }
/// ```
#[cfg(all(feature = "tokio_time", not(feature = "async_std_time")))]
#[macro_export]
macro_rules! inner_wait {
($actor:expr,$timeout:expr,$fun:expr) => {
tokio::time::timeout(std::time::Duration::from_millis($timeout), $actor.inner_call($fun))
};
}
/// inner call wait ms throw time error
/// need on feature "tokio_time" or "async_std_time"
/// # async_std runtime:
/// ``` toml
/// aqueue = { version = "^1.2.10", features = ["async_std_time"] }
/// ```
/// # Example
/// ``` ignore
/// async fn test_unsafe_blocking(&self, name: String, gold: f64) -> Result<bool> {
/// inner_wait!(self, 30000, |_| async move { DB.insert_user(name, gold).await }).await?
/// }
/// ```
#[cfg(all(feature = "async_std_time", not(feature = "tokio_time")))]
#[macro_export]
macro_rules! inner_wait {
($actor:expr,$timeout:expr,$fun:expr) => {
async_std::future::timeout(std::time::Duration::from_millis($timeout), $actor.inner_call($fun))
};
}