History

refactor

* make `Send` docs more prominent * add test

Sebastian Thiel committed 1 year ago

Commit d7ddbb71 parent 687322b2 files · +15 −3Browse files

Unified · Split

2 files
  1. gix/src/types.rs +7 −3
  2. gix/tests/gix/repository/mod.rs +8 −0
gix/src/types.rs+7−3
@@ -150,7 +150,9 @@ pub struct Reference<'r> { · 149 unmodified lines
150/// and explicitly. This is to have the fastest-possible default configuration available by default, but allow150/// and explicitly. This is to have the fastest-possible default configuration available by default, but allow
151/// those who experiment with workloads to get speed boosts of 2x or more.151/// those who experiment with workloads to get speed boosts of 2x or more.
152///152///
153/// Note: when built with `default-features = false`, this type is **not** `Send`.153/// ### `Send` only with `parallel` feature
154///
155/// When built with `default-features = false`, this type is **not** `Send`.
154/// The minimal feature set to activate `Send` is `features = ["parallel"]`.156/// The minimal feature set to activate `Send` is `features = ["parallel"]`.
155pub struct Repository {157pub struct Repository {
156 /// A ref store with shared ownership (or the equivalent of it).158 /// A ref store with shared ownership (or the equivalent of it).
@@ -186,8 +188,10 @@ pub struct Repository { · 29 unmodified lines
186///188///
187/// Note that it can also cheaply be cloned, and it will retain references to all contained resources.189/// Note that it can also cheaply be cloned, and it will retain references to all contained resources.
188///190///
189/// Note: when built with `default-features = false`, this type is **not** `Send` or `Sync`.191/// ### `Send` only with `parallel` feature
190/// The minimal feature set to activate `Send + Sync` is `features = ["parallel"]`.192///
193/// When built with `default-features = false`, this type is **not** `Send`.
194/// The minimal feature set to activate `Send` is `features = ["parallel"]`.
191#[derive(Clone)]195#[derive(Clone)]
192pub struct ThreadSafeRepository {196pub struct ThreadSafeRepository {
193 /// A store for references to point at objects197 /// A store for references to point at objects
gix/tests/gix/repository/mod.rs+8−0
@@ -138,3 +138,11 @@ fn thread_safe_repository_is_sync() -> crate::Result { · 137 unmodified lines
138 f(crate::util::basic_repo()?.into_sync());138 f(crate::util::basic_repo()?.into_sync());
139 Ok(())139 Ok(())
140}140}
141
142#[test]
143#[cfg(feature = "parallel")]
144fn repository_is_send() -> crate::Result {
145 fn f<T: Send + Clone>(_t: T) {}
146 f(crate::util::basic_repo()?);
147 Ok(())
148}