arti-client: Mark DirProviderBuilder Send+Sync;

Doing this causes TorClientBuilder to become Send.  I also add a
test to ensure that TorClientBuilder remains Send in the future.

This isn't a semver break, but only because DirProviderBuilder is
marked with `experimental-api`.

Closes #924
This commit is contained in:
Nick Mathewson 2023-06-26 09:49:56 -04:00
parent b31a253931
commit 30124acbc5
1 changed files with 15 additions and 1 deletions

View File

@ -13,7 +13,7 @@ use tor_rtcompat::Runtime;
/// feature is enabled.
#[allow(unreachable_pub)]
#[cfg_attr(docsrs, doc(cfg(feature = "experimental-api")))]
pub trait DirProviderBuilder<R: Runtime> {
pub trait DirProviderBuilder<R: Runtime>: Send + Sync {
fn build(
&self,
runtime: R,
@ -162,3 +162,17 @@ impl<R: Runtime> TorClientBuilder<R> {
Ok(r)
}
}
#[cfg(test)]
mod test {
use tor_rtcompat::PreferredRuntime;
use super::*;
fn must_be_send<S: Send>() {}
#[test]
fn builder_is_send() {
must_be_send::<TorClientBuilder<PreferredRuntime>>();
}
}