diff --git a/crates/arti-client/src/lib.rs b/crates/arti-client/src/lib.rs index 69e3cf578..84920df08 100644 --- a/crates/arti-client/src/lib.rs +++ b/crates/arti-client/src/lib.rs @@ -118,14 +118,16 @@ //! will expect a type that implements [`tor_rtcompat::Runtime`], which can be obtained: //! //! - for Tokio: -//! - by calling [`tor_rtcompat::tokio::current_runtime`], if a Tokio reactor is already running -//! - by calling [`tor_rtcompat::tokio::create_runtime`], to start a new reactor if one is not +//! - by calling [`tor_rtcompat::tokio::PreferredRuntime::current()`], if a Tokio reactor is already running +//! - by calling [`tor_rtcompat::tokio::PreferredRuntime::create()`], to start a new reactor if one is not //! already running -//! - by manually creating a [`TokioRuntimeHandle`](tor_rtcompat::tokio::TokioRuntimeHandle) from -//! an existing Tokio runtime handle +//! - as above, but explicitly specifying [`TokioNativeTlsRuntime`](tor_rtcompat::tokio::TokioNativeTlsRuntime) +//! or [`TokioRustlsRuntime`](tor_rtcompat::tokio::TokioRustlsRuntime) in place of `PreferredRuntime`. //! - for async-std: -//! - by calling [`tor_rtcompat::async_std::current_runtime`], which will create a runtime or +//! - by calling [`tor_rtcompat::async_std::PreferredRuntime::current()`], which will create a runtime or //! retrieve the existing one, if one has already been started +//! - as above, but explicitly specifying [`AsyncStdNativeTlsRuntime`](tor_rtcompat::async_std::AsyncStdNativeTlsRuntime) +//! or [`AsyncStdRustlsRuntime`](tor_rtcompat::async_std::AsyncStdRustlsRuntime) in place of `PreferredRuntime`. //! //! //! # Feature flags diff --git a/crates/tor-rtcompat/src/lib.rs b/crates/tor-rtcompat/src/lib.rs index efcdd8abd..81ac2b9d2 100644 --- a/crates/tor-rtcompat/src/lib.rs +++ b/crates/tor-rtcompat/src/lib.rs @@ -60,11 +60,13 @@ //! * If you want to construct a default runtime that you won't be //! using for anything besides Arti, you can use [`create_runtime()`]. //! -//! * If you want to explicitly construct a runtime with a specific -//! backend, you can do so with [`async_std::create_runtime`] or -//! [`tokio::create_runtime`]. Or if you have already constructed a +//! * If you want to use a runtime with an explicitly chosen backend, +//! name its type directly as [`async_std::AsyncStdNativeTlsRuntime`], +//! [`async_std::AsyncStdRustlsRuntime`], [`tokio::TokioNativeTlsRuntime`], +//! or [`tokio::TokioRustlsRuntime`]. To construct one of these runtimes, +//! call its `create()` method. Or if you have already constructed a //! tokio runtime that you want to use, you can wrap it as a -//! [`Runtime`] explicitly with [`tokio::TokioRuntimeHandle`]. +//! [`Runtime`] explicitly with `current()`. //! //! # Cargo features //! @@ -234,7 +236,7 @@ pub fn current_user_runtime() -> std::io::Result { /// /// Tokio users may want to avoid this function and instead make a /// runtime using [`current_user_runtime()`] or -/// [`tokio::current_runtime()`]: this function always _builds_ a +/// [`tokio::PreferredRuntime::current()`]: this function always _builds_ a /// runtime, and if you already have a runtime, that isn't what you /// want with Tokio. /// diff --git a/crates/tor-rtcompat/src/tokio.rs b/crates/tor-rtcompat/src/tokio.rs index 7a504e56d..67b2341e5 100644 --- a/crates/tor-rtcompat/src/tokio.rs +++ b/crates/tor-rtcompat/src/tokio.rs @@ -24,7 +24,7 @@ pub use TokioNativeTlsRuntime as PreferredRuntime; #[cfg(all(feature = "rustls", not(feature = "native-tls")))] pub use TokioRustlsRuntime as PreferredRuntime; -/// A [`Runtime`] built around a Handle to a tokio runtime, and `native_tls`. +/// A [`Runtime`](crate::Runtime) built around a Handle to a tokio runtime, and `native_tls`. /// /// # Limitations /// @@ -42,7 +42,7 @@ pub struct TokioNativeTlsRuntime { #[cfg(feature = "native-tls")] type HandleInner = CompoundRuntime>; -/// A [`Runtime`] built around a Handle to a tokio runtime, and `rustls`. +/// A [`Runtime`](crate::Runtime) built around a Handle to a tokio runtime, and `rustls`. #[derive(Clone)] #[cfg(feature = "rustls")] pub struct TokioRustlsRuntime { @@ -107,7 +107,7 @@ impl TokioNativeTlsRuntime { /// We should never call this from inside other Arti crates, or from library /// crates that want to support multiple runtimes! This function is for /// Arti _users_ who want to wrap some existing Tokio runtime as a - /// [`Runtime`]. It is not for library crates that want to work with + /// [`Runtime`](crate::Runtime). It is not for library crates that want to work with /// multiple runtimes. /// /// Once you have a runtime returned by this function, you should just @@ -154,7 +154,7 @@ impl TokioRustlsRuntime { /// We should never call this from inside other Arti crates, or from library /// crates that want to support multiple runtimes! This function is for /// Arti _users_ who want to wrap some existing Tokio runtime as a - /// [`Runtime`]. It is not for library crates that want to work with + /// [`Runtime`](crate::Runtime). It is not for library crates that want to work with /// multiple runtimes. /// /// Once you have a runtime returned by this function, you should just