mirror of
https://github.com/fafhrd91/actix-net
synced 2025-08-25 18:16:03 +02:00
new_async
-> run_in_executor
and return future directly + builder cleanup
This commit is contained in:
@@ -2,11 +2,12 @@ use std::cell::RefCell;
|
||||
use std::io;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
use tokio_current_thread::Handle;
|
||||
use futures::sync::mpsc::UnboundedSender;
|
||||
use futures::Future;
|
||||
use tokio_current_thread::Handle;
|
||||
|
||||
use crate::arbiter::{Arbiter, SystemCommand};
|
||||
use crate::builder::{Builder, SystemRunner, AsyncSystemRunner};
|
||||
use crate::builder::{AsyncSystemRunner, Builder, SystemRunner};
|
||||
|
||||
static SYSTEM_COUNT: AtomicUsize = AtomicUsize::new(0);
|
||||
|
||||
@@ -60,8 +61,14 @@ impl System {
|
||||
/// Create new system using provided CurrentThread Handle.
|
||||
///
|
||||
/// This method panics if it can not spawn system arbiter
|
||||
pub fn new_async<T: Into<String>>(name: T, executor: Handle) -> AsyncSystemRunner {
|
||||
Self::builder().name(name).build_async(executor)
|
||||
pub fn run_in_executor<T: Into<String>>(
|
||||
name: T,
|
||||
executor: Handle,
|
||||
) -> Box<Future<Item = (), Error = io::Error> + Send + 'static> {
|
||||
Self::builder()
|
||||
.name(name)
|
||||
.build_async(executor)
|
||||
.run_nonblocking()
|
||||
}
|
||||
|
||||
/// Get current running system.
|
||||
|
Reference in New Issue
Block a user