pub fn do_in_into(
        when: Duration,
        action: impl Future<Output = T> + 'static,
        tq: TaskQueueHandle,
    ) -> Result<TimerActionOnce<T>> {
        let reactor = crate::executor().reactor();
        let timer_id = reactor.register_timer();
        let timer = Timer::from_id(timer_id, when);
        let inner = timer.inner.clone();

        let task = crate::spawn_local_into(
            async move {
                timer.await;
                action.await
            },
            tq,
        )?;

        Ok(TimerActionOnce {
            handle: task.detach(),
            inner,
            reactor: Rc::downgrade(&reactor),
        })
    }
/// Creates a [`TimerActionOnce`] that will execute the associated future
/// once after some time is passed in a specific Task Queue
///
/// # Arguments
///
/// * `when` a [`Duration`] that represents when to execute the action.
/// * `action` a Future to be executed after `when` is elapsed.
/// * `tq` the [`TaskQueueHandle`] for the TaskQueue we want.
///
/// # Examples
///
/// ```
/// use glommio::{timer::TimerActionOnce, Latency, LocalExecutorBuilder, Shares};
/// use std::time::Duration;
///
/// let handle = LocalExecutorBuilder::new()
///     .spawn(|| async move {
///         let tq = glommio::executor().create_task_queue(
///             Shares::default(),
///             Latency::NotImportant,
///             "test",
///         );
///         let action = TimerActionOnce::do_in_into(
///             Duration::from_millis(100),
///             async move {
///                 println!("Executed once");
///             },
///             tq,
///         )
///         .unwrap();
///         action.join().await;
///     })
///     .unwrap();
/// handle.join().unwrap();
/// ```
/// [`Duration`]: https://doc.rust-lang.org/std/time/struct.Duration.html
/// [`TimerActionOnce`]: struct.TimerActionOnce.html
/// [`TaskQueueHandle`]: ../struct.TaskQueueHandle.html
Creates a [`TimerActionOnce`] that will execute the associated future
once after some time is passed in a specific Task Queue
Creates a [ ` TimerActionOnce ` ] that will execute the associated future once after some time is passed in a specific Task Queue
pub fn do_in_into(
        when: Duration,
        action: impl Future<Output = T> + 'static,
        tq: TaskQueueHandle,
    ) -> Result<TimerActionOnce<T>> {
        let reactor = crate::executor().reactor();
        let timer_id = reactor.register_timer();
        let timer = Timer::from_id(timer_id, when);
        let inner = timer.inner.clone();
        let task = crate::spawn_local_into(
            async move {
                timer.await;
                action.await
            },
            tq,
        )?;
        Ok(TimerActionOnce {
            handle: task.detach(),
            inner,
            reactor: Rc::downgrade(&reactor),
        })
    }
pub fn do_in_into ( when : Duration , action : impl Future < Output = T > + ' static , tq : TaskQueueHandle , ) -> Result < TimerActionOnce < T > > { let reactor = crate :: executor ( ) . reactor ( ) ; let timer_id = reactor . register_timer ( ) ; let timer = Timer :: from_id ( timer_id , when ) ; let inner = timer . inner . clone ( ) ; let task = crate :: spawn_local_into ( async move { timer . await ; action . await } , tq , ) ? ; Ok ( TimerActionOnce { handle : task . detach ( ) , inner , reactor : Rc :: downgrade ( & reactor ) , } ) }
Creates a [`TimerActionOnce`] that will execute the associated future
once after some time is passed in a specific Task Queue
Creates a [ ` TimerActionOnce ` ] that will execute the associated future once after some time is passed in a specific Task Queue
when
Duration
action
impl Future<Output = T> + 'static
tq
TaskQueueHandle
when
Duration
action
impl Future<Output = T> + 'static
tq
TaskQueueHandle
examples
```
use glommio::{timer::TimerActionOnce, Latency, LocalExecutorBuilder, Shares};
use std::time::Duration.


` ` ` use glommio :: { timer :: TimerActionOnce Latency LocalExecutorBuilder Shares } ; use std :: time :: Duration .