From 5187b05c191193b4f8afc16ac1b16110ae4dbfbd Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 28 Jan 2022 08:36:34 -0500 Subject: [PATCH] Use script to update README.md files. --- crates/arti-client/README.md | 14 ++++++++------ crates/tor-proto/README.md | 3 --- crates/tor-rtcompat/README.md | 14 ++++++++------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/crates/arti-client/README.md b/crates/arti-client/README.md index aa2f1220b..8ff5309dd 100644 --- a/crates/arti-client/README.md +++ b/crates/arti-client/README.md @@ -57,7 +57,7 @@ If you really want to connect to a raw IP address and know what you're doing, ta let config = TorClientConfig::default(); // Arti needs a handle to an async runtime in order to spawn tasks and use the // network. (See "Multiple runtime support" below.) -let rt = tor_rtcompat::tokio::current_runtime()?; +let rt = tor_rtcompat::tokio::TokioNativeTlsRuntime::current()?; // Start the Arti client, and let it bootstrap a connection to the Tor network. // (This takes a while to gather the necessary directory information. @@ -113,14 +113,16 @@ Functions in this crate, like [`TorClient::bootstrap`], 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-proto/README.md b/crates/tor-proto/README.md index 8546aae6c..3b62a1427 100644 --- a/crates/tor-proto/README.md +++ b/crates/tor-proto/README.md @@ -84,7 +84,4 @@ I bet that there are deadlocks somewhere in this code. I fixed all the ones I could find or think of, but it would be great to find a good way to eliminate every lock that we have. -This crate doesn't work with rusttls because of a limitation in the -webpki crate. - License: MIT OR Apache-2.0 diff --git a/crates/tor-rtcompat/README.md b/crates/tor-rtcompat/README.md index 86d5ac93c..1004b2a21 100644 --- a/crates/tor-rtcompat/README.md +++ b/crates/tor-rtcompat/README.md @@ -42,7 +42,7 @@ traits it provides. The `tor-rtcompat` crate provides several traits that encapsulate different runtime capabilities. - * A runtime is a [`SpawnBlocking`] if it can block on a future. + * A runtime is a [`BlockOn`] if it can block on a future. * A runtime is a [`SleepProvider`] if it can make timer futures that become Ready after a given interval of time. * A runtime is a [`TcpProvider`] if it can make and receive TCP @@ -62,11 +62,13 @@ You can get a [`Runtime`] in several ways: * 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_async_std_runtime`] or - [`tokio::create_tokio_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 @@ -94,7 +96,7 @@ to other environments (like WASM) in the future. We could simplify this code significantly by removing most of the traits it exposes, and instead just exposing a single implementation. For example, instead of exposing a -[`SpawnBlocking`] trait to represent blocking until a task is +[`BlockOn`] trait to represent blocking until a task is done, we could just provide a single global `block_on` function. That simplification would come at a cost, however. First of all,