diff --git a/changelog.d/20011.misc b/changelog.d/20011.misc index 859d619a95..9582106675 100644 --- a/changelog.d/20011.misc +++ b/changelog.d/20011.misc @@ -1 +1 @@ -Refactor Rust code have a single place to store per-reactor state. +Refactor the Rust code to have a single place to store per-homeserver state. diff --git a/rust/src/homeserver.rs b/rust/src/homeserver.rs index dbff7f5b32..74885d5e09 100644 --- a/rust/src/homeserver.rs +++ b/rust/src/homeserver.rs @@ -23,7 +23,7 @@ use crate::runtime::RustRuntime; /// The Python `HomeServer`, as seen from Rust. /// /// Like [`crate::reactor::Reactor`], this is a typed facade over a foreign -/// Python object: it does no validation of the object it wraps (the Python +/// Python object. It does no validation of the object it wraps (the Python /// side is type-checked by mypy), but it is the single place that names the /// `HomeServer` API surface that Rust code depends on. pub struct HomeServer(Py); diff --git a/rust/src/reactor.rs b/rust/src/reactor.rs index 2ac4d1a3be..db958d82b3 100644 --- a/rust/src/reactor.rs +++ b/rust/src/reactor.rs @@ -19,7 +19,7 @@ use pyo3::{call::PyCallArgs, intern, prelude::*}; /// The Twisted reactor, as seen from Rust. /// -/// A typed facade over a foreign Python object: it does no validation of the +/// A typed facade over a foreign Python object. It does no validation of the /// object it wraps (the Python side is type-checked by mypy), but it is the /// single place that names the Twisted API surface that Rust code depends /// on. diff --git a/rust/src/runtime.rs b/rust/src/runtime.rs index 51b9e587bf..7d6e329eec 100644 --- a/rust/src/runtime.rs +++ b/rust/src/runtime.rs @@ -125,9 +125,8 @@ impl Drop for RustRuntimeInner { /// /// One instance is constructed per homeserver by /// `HomeServer.get_rust_runtime()`. Rust classes that need it take it as a -/// constructor argument — pyo3 extracts a `#[pyclass]` that is `Clone` by -/// cloning, which here is just an `Arc` refcount bump — and hold their own -/// clone. Derefs to [`RustRuntimeInner`]. +/// constructor argument and store their own clone, which is just an `Arc` +/// refcount bump. Derefs to [`RustRuntimeInner`]. #[pyclass(frozen, skip_from_py_object)] #[derive(Clone)] pub struct RustRuntime { @@ -154,7 +153,7 @@ impl RustRuntime { }); // Shut the tokio runtime down when the reactor does. The trigger - // holds only a `Weak` reference: Twisted keeping the hook alive must + // holds only a `Weak` reference. Twisted keeping the hook alive must // not keep the runtime (nor, via it, the reactor) alive, as that // would be a reference cycle passing through a Rust field that // Python's GC cannot see into. diff --git a/synapse/synapse_rust/runtime.pyi b/synapse/synapse_rust/runtime.pyi index fb61ab81aa..b4aaaae907 100644 --- a/synapse/synapse_rust/runtime.pyi +++ b/synapse/synapse_rust/runtime.pyi @@ -5,7 +5,7 @@ class RustRuntime: Holds the tokio thread pool (started lazily on first use, shut down by a reactor shutdown trigger) and a handle to the reactor. Rust classes that - need either take this as a constructor argument; get it from + need them take this as a constructor argument. Get it from `hs.get_rust_runtime()`. """