Created
April 17, 2019 19:27
-
-
Save DoumanAsh/fa5ce392bfc3f4302e1f30cd3ae25345 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///Trait to bootstrap your futures. | |
pub trait AutoRuntime: futures::Future { | |
///Runs futures to completion. | |
/// | |
///## Note | |
/// | |
///It must not be used from within async context | |
#[cfg(not(feature = "multi"))] | |
fn finish(self) -> Result<Self::Item, Self::Error>; | |
#[cfg(feature = "multi")] | |
fn finish(self) -> Result<Self::Item, Self::Error> where Self::Item: Send, Self::Error: Send; | |
///Spawns futures onto global runtime. | |
/// | |
///## Note | |
/// | |
///Can be used in any context, but it requires future that returns nothing | |
fn spawn(self) where Self: 'static + futures::Future<Item=(), Error=()>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment