[][src]Trait pasts::prelude::Interrupt

pub trait Interrupt: Send + Sync + Sized {
    fn new() -> Self;
fn interrupt(&self);
fn wait_for(&self); fn block_on<F: Future>(f: F) -> <F as Future>::Output { ... } }

An interrupt handler.

Required methods

fn new() -> Self

Initialize the shared data for the interrupt.

fn interrupt(&self)

Interrupt blocking to wake up.

fn wait_for(&self)

Blocking wait until interrupt.

Loading content...

Provided methods

fn block_on<F: Future>(f: F) -> <F as Future>::Output

Run a future to completion on the current thread. This will cause the current thread to block.

use pasts::prelude::*;

let ret = pasts::ThreadInterrupt::block_on(
    async {
        /* Do some work, calling .await on futures */
        "Complete!"
    }
);
assert_eq!(ret, "Complete!");
Loading content...

Implementors

impl Interrupt for ThreadInterrupt[src]

Loading content...