Review fixes

This commit is contained in:
Igor Aleksanov 2020-08-08 09:28:27 +03:00
parent 9cb8760679
commit 9a19b08bcf
2 changed files with 10 additions and 9 deletions

View File

@ -25,5 +25,4 @@ smallvec = "1"
tokio = { version = "0.2.6", default-features = false, features = ["rt-core", "rt-util", "io-driver", "tcp", "uds", "udp", "time", "signal", "stream"] } tokio = { version = "0.2.6", default-features = false, features = ["rt-core", "rt-util", "io-driver", "tcp", "uds", "udp", "time", "signal", "stream"] }
[dev-dependencies] [dev-dependencies]
futures = "0.3"
tokio = { version = "0.2.6", features = ["full"] } tokio = { version = "0.2.6", features = ["full"] }

View File

@ -63,17 +63,18 @@ impl System {
/// ///
/// Note: This method uses provided `LocalSet` to create a `System` future only. /// Note: This method uses provided `LocalSet` to create a `System` future only.
/// All the [`Arbiter`]s will be started in separate threads using their own tokio `Runtime`s. /// All the [`Arbiter`]s will be started in separate threads using their own tokio `Runtime`s.
/// It means that using this method currently it is impossible to make `actix-rt` work in the `Runtime` other /// It means that using this method currently it is impossible to make `actix-rt` work in the
/// than the provided by `tokio` 0.2 (e.g. provided by `tokio_compat`). /// alternative `tokio` `Runtime`s (e.g. provided by [`tokio_compat`]).
/// ///
/// [`Arbiter`]: struct.Arbiter.html /// [`Arbiter`]: struct.Arbiter.html
/// [`tokio_compat`]: https://crates.io/crates/tokio-compat
/// ///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// use tokio::{runtime::Runtime, task::LocalSet}; /// use tokio::{runtime::Runtime, task::LocalSet};
/// use actix_rt::System; /// use actix_rt::System;
/// use futures::future::try_join_all; /// use futures_util::future::try_join_all;
/// ///
/// async fn run_application() { /// async fn run_application() {
/// let first_task = tokio::spawn(async { /// let first_task = tokio::spawn(async {
@ -128,14 +129,15 @@ impl System {
/// Note: This method uses provided `Runtime` to create a `System` future only. /// Note: This method uses provided `Runtime` to create a `System` future only.
/// All the [`Arbiter`]s will be started in separate threads using their own tokio `Runtime`s. /// All the [`Arbiter`]s will be started in separate threads using their own tokio `Runtime`s.
/// It means that using this method currently it is impossible to make `actix-rt` work in the /// It means that using this method currently it is impossible to make `actix-rt` work in the
/// `Runtime` other than the provided by `tokio` 0.2 (e.g. provided by `tokio_compat`). /// alternative `tokio` `Runtime`s (e.g. provided by `tokio_compat`).
/// ///
/// [`Arbiter`]: struct.Arbiter.html /// [`Arbiter`]: struct.Arbiter.html
/// [`tokio_compat`]: https://crates.io/crates/tokio-compat
/// ///
/// # Arguments /// # Arguments
/// ///
/// - `runtime`: A tokio Runtime to run the system in.
/// - `name`: Name of the System /// - `name`: Name of the System
/// - `runtime`: A tokio Runtime to run the system in.
/// - `rest_operations`: A future to be executed in the runtime along with the System. /// - `rest_operations`: A future to be executed in the runtime along with the System.
/// ///
/// # Examples /// # Examples
@ -143,7 +145,7 @@ impl System {
/// ``` /// ```
/// use tokio::runtime::Runtime; /// use tokio::runtime::Runtime;
/// use actix_rt::System; /// use actix_rt::System;
/// use futures::future::try_join_all; /// use futures_util::future::try_join_all;
/// ///
/// async fn run_application() { /// async fn run_application() {
/// let first_task = tokio::spawn(async { /// let first_task = tokio::spawn(async {
@ -172,11 +174,11 @@ impl System {
/// .unwrap(); /// .unwrap();
/// ///
/// let rest_operations = run_application(); /// let rest_operations = run_application();
/// System::attach_to_tokio(runtime, "actix-main-system", rest_operations); /// System::attach_to_tokio("actix-main-system", runtime, rest_operations);
/// ``` /// ```
pub fn attach_to_tokio<Fut, R>( pub fn attach_to_tokio<Fut, R>(
mut runtime: tokio::runtime::Runtime,
name: impl Into<String>, name: impl Into<String>,
mut runtime: tokio::runtime::Runtime,
rest_operations: Fut, rest_operations: Fut,
) -> R ) -> R
where where