Skip to content

Refactor multiple runtime support in order to clean up documentation

eta requested to merge eta/arti:eta/326 into main

tor-rtcompat: refactor PreferredRuntime, clean up docs

PreferredRuntime is now an opaque wrapper struct that contains the "actual" preferred runtime as a type alias. The current_user_runtime and create_runtime functions become PreferredRuntime::current and PreferredRuntime::create, respectively.

This removes the dependence on impl Trait, meaning we can now name the returned runtime (yay!).

In addition, the documentation was cleaned up a bit to make it (hopefully) flow better. Items that don't make sense to publicize, like testing implementation details, have been marked #[doc(hidden)] and semver warnings added.

arti-client: use PreferredRuntime by default, doc cleanups

This makes using the PreferredRuntime the first-class option inside arti-client, freeing users who don't want to think about runtimes from having to do so.

TorClient::create_unbootstrapped and builder now automatically use this runtime, leaving only builder_custom for users who wish to manually specify a runtime.

This lets us clean up the docs a lot: mentions of using custom runtimes are now relegated to nearer the end of the crate-level documentation, and we mostly just link to tor_rtcompat's docs to explain more there. Instead, we take some more time to explain how you use the builder API to create clients synchronously.

Other doc cleanups included getting rid of the explanation of TorAddr in the main crate-level doc; this is already well-documented elsewhere, and is something users should discover organically later.

Merge request reports

Loading