Use script to update README.md files.

This commit is contained in:
Nick Mathewson 2022-01-28 08:36:34 -05:00
parent 427e07ec8a
commit 5187b05c19
3 changed files with 16 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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,