Skip to content

Commit 79cb655

Browse files
authored
Merge pull request #1807 from bryceberger/bryce/push-xqrmpyoxlosq
docs: specify ThreadSafeRepository is not Send/Sync without "parallel"
2 parents 6065af5 + d7ddbb7 commit 79cb655

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

gix/src/types.rs

+10
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ pub struct Reference<'r> {
149149
/// Note that it clones itself so that it is empty, requiring the user to configure each clone separately, specifically
150150
/// and explicitly. This is to have the fastest-possible default configuration available by default, but allow
151151
/// those who experiment with workloads to get speed boosts of 2x or more.
152+
///
153+
/// ### `Send` only with `parallel` feature
154+
///
155+
/// When built with `default-features = false`, this type is **not** `Send`.
156+
/// The minimal feature set to activate `Send` is `features = ["parallel"]`.
152157
pub struct Repository {
153158
/// A ref store with shared ownership (or the equivalent of it).
154159
pub refs: crate::RefStore,
@@ -182,6 +187,11 @@ pub struct Repository {
182187
/// it's merely meant to be able to exist in a `Sync` context.
183188
///
184189
/// Note that it can also cheaply be cloned, and it will retain references to all contained resources.
190+
///
191+
/// ### `Send` only with `parallel` feature
192+
///
193+
/// When built with `default-features = false`, this type is **not** `Send`.
194+
/// The minimal feature set to activate `Send` is `features = ["parallel"]`.
185195
#[derive(Clone)]
186196
pub struct ThreadSafeRepository {
187197
/// A store for references to point at objects

gix/tests/gix/repository/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,11 @@ fn thread_safe_repository_is_sync() -> crate::Result {
138138
f(crate::util::basic_repo()?.into_sync());
139139
Ok(())
140140
}
141+
142+
#[test]
143+
#[cfg(feature = "parallel")]
144+
fn repository_is_send() -> crate::Result {
145+
fn f<T: Send + Clone>(_t: T) {}
146+
f(crate::util::basic_repo()?);
147+
Ok(())
148+
}

0 commit comments

Comments
 (0)