rumtk_create_task

Macro rumtk_create_task 

Source
macro_rules! rumtk_create_task {
    ( $func:expr ) => { ... };
    ( $func:expr, $args:expr ) => { ... };
}
Expand description

This macro creates an async body that calls the async closure and awaits it.

ยงExample

use std::sync::{Arc, RwLock};
use tokio::sync::RwLock as AsyncRwLock;
use rumtk_core::strings::RUMString;
use rumtk_core::threading::threading_manager::{SafeTaskArgs, TaskItems};

pub type SafeTaskArgs2<T> = Arc<RwLock<TaskItems<T>>>;
let expected = vec![
    RUMString::from("Hello"),
    RUMString::from("World!"),
    RUMString::from("Overcast"),
    RUMString::from("and"),
    RUMString::from("Sad"),
 ];
let locked_args = AsyncRwLock::new(expected.clone());
let task_args = SafeTaskArgs::<RUMString>::new(locked_args);