@@ -109,8 +109,8 @@ mod imp;
109
109
/// Some usage examples can be found in the crate documentation for using a
110
110
/// client.
111
111
///
112
- /// Note that a `Client` implements the `Clone` trait, and all instances of a
113
- /// `Client` refer to the same jobserver instance.
112
+ /// Note that a [ `Client`] implements the [ `Clone`] trait, and all instances of
113
+ /// a [ `Client`] refer to the same jobserver instance.
114
114
#[ derive( Clone , Debug ) ]
115
115
pub struct Client {
116
116
inner : Arc < imp:: Client > ,
@@ -128,13 +128,13 @@ pub struct Acquired {
128
128
}
129
129
130
130
impl Acquired {
131
- /// This drops the `Acquired` token without releasing the associated token.
131
+ /// This drops the [ `Acquired`] token without releasing the associated token.
132
132
///
133
133
/// This is not generally useful, but can be helpful if you do not have the
134
134
/// ability to store an Acquired token but need to not yet release it.
135
135
///
136
- /// You'll typically want to follow this up with a call to `release_raw` or
137
- /// similar to actually release the token later on.
136
+ /// You'll typically want to follow this up with a call to
137
+ /// [`Client::release_raw`] or similar to actually release the token later on.
138
138
pub fn drop_without_releasing ( mut self ) {
139
139
self . disabled = true ;
140
140
}
@@ -156,7 +156,7 @@ struct HelperInner {
156
156
use error:: FromEnvErrorInner ;
157
157
pub use error:: { FromEnvError , FromEnvErrorKind } ;
158
158
159
- /// Return type for ` from_env_ext` function.
159
+ /// Return type for [`Client:: from_env_ext`] function.
160
160
#[ derive( Debug ) ]
161
161
pub struct FromEnv {
162
162
/// Result of trying to get jobserver client from env.
@@ -186,12 +186,12 @@ impl Client {
186
186
///
187
187
/// A client to the jobserver created will be returned. This client will
188
188
/// allow at most `limit` tokens to be acquired from it in parallel. More
189
- /// calls to ` acquire` will cause the calling thread to block.
189
+ /// calls to [`Client:: acquire`] will cause the calling thread to block.
190
190
///
191
- /// Note that the created `Client` is not automatically inherited into
191
+ /// Note that the created [ `Client`] is not automatically inherited into
192
192
/// spawned child processes from this program. Manual usage of the
193
- /// ` configure` function is required for a child process to have access to a
194
- /// job server.
193
+ /// [`Client:: configure`] function is required for a child process to have
194
+ /// access to a job server.
195
195
///
196
196
/// # Examples
197
197
///
@@ -219,14 +219,14 @@ impl Client {
219
219
/// it's passing down. This function will attempt to look for these details
220
220
/// and connect to the jobserver.
221
221
///
222
- /// Note that the created `Client` is not automatically inherited into
222
+ /// Note that the created [ `Client`] is not automatically inherited into
223
223
/// spawned child processes from this program. Manual usage of the
224
- /// ` configure` function is required for a child process to have access to a
225
- /// job server.
224
+ /// [`Client:: configure`] function is required for a child process to have
225
+ /// access to a job server.
226
226
///
227
227
/// # Return value
228
228
///
229
- /// `FromEnv` contains result and relevant environment variable.
229
+ /// [ `FromEnv`] contains result and relevant environment variable.
230
230
/// If a jobserver was found in the environment and it looks correct then
231
231
/// result with the connected client will be returned. In other cases
232
232
/// result will contain `Err(FromEnvErr)`.
@@ -281,7 +281,7 @@ impl Client {
281
281
/// Attempts to connect to the jobserver specified in this process's
282
282
/// environment.
283
283
///
284
- /// Wraps ` from_env_ext` and discards error details.
284
+ /// Wraps [`Client:: from_env_ext`] and discards error details.
285
285
///
286
286
/// # Safety
287
287
///
@@ -306,7 +306,7 @@ impl Client {
306
306
///
307
307
/// # Return value
308
308
///
309
- /// On successful acquisition of a token an instance of `Acquired` is
309
+ /// On successful acquisition of a token an instance of [ `Acquired`] is
310
310
/// returned. This structure, when dropped, will release the token back to
311
311
/// the jobserver. It's recommended to avoid leaking this value.
312
312
///
@@ -342,9 +342,10 @@ impl Client {
342
342
///
343
343
/// This function is required to be called to ensure that a jobserver is
344
344
/// properly inherited to a child process. If this function is *not* called
345
- /// then this `Client` will not be accessible in the child process. In other
346
- /// words, if not called, then `Client::from_env` will return `None` in the
347
- /// child process (or the equivalent of `Child::from_env` that `make` uses).
345
+ /// then this [`Client`] will not be accessible in the child process. In
346
+ /// other words, if not called, then [`Client::from_env`] will return `None`
347
+ /// in the child process (or the equivalent of [`Client::from_env`] that
348
+ /// `make` uses).
348
349
///
349
350
/// ## Platform-specific behavior
350
351
///
@@ -363,9 +364,10 @@ impl Client {
363
364
///
364
365
/// This function is required to be called to ensure that a jobserver is
365
366
/// properly inherited to a child process. If this function is *not* called
366
- /// then this `Client` will not be accessible in the child process. In other
367
- /// words, if not called, then `Client::from_env` will return `None` in the
368
- /// child process (or the equivalent of `Child::from_env` that `make` uses).
367
+ /// then this [`Client`] will not be accessible in the child process. In
368
+ /// other words, if not called, then [`Client::from_env`] will return `None`
369
+ /// in the child process (or the equivalent of [`Client::from_env`] that
370
+ /// `make` uses).
369
371
///
370
372
/// ## Platform-specific behavior
371
373
///
@@ -391,19 +393,18 @@ impl Client {
391
393
format ! ( "-j --jobserver-fds={0} --jobserver-auth={0}" , arg)
392
394
}
393
395
394
- /// Converts this `Client` into a helper thread to deal with a blocking
395
- /// ` acquire` function a little more easily.
396
+ /// Converts this [ `Client`] into a helper thread to deal with a blocking
397
+ /// [`Client:: acquire`] function a little more easily.
396
398
///
397
- /// The fact that the `acquire` function on `Client` blocks isn't always
398
- /// the easiest to work with. Typically you're using a jobserver to
399
- /// manage running other events in parallel! This means that you need to
400
- /// either (a) wait for an existing job to finish or (b) wait for a
401
- /// new token to become available.
399
+ /// The fact that the [`Client::acquire`] isn't always the easiest to work
400
+ /// with. Typically you're using a jobserver to manage running other events
401
+ /// in parallel! This means that you need to either (a) wait for an existing
402
+ /// job to finish or (b) wait for a new token to become available.
402
403
///
403
- /// Unfortunately the blocking in ` acquire` happens at the implementation
404
- /// layer of jobservers. On Unix this requires a blocking call to `read`
405
- /// and on Windows this requires one of the `WaitFor*` functions. Both
406
- /// of these situations aren't the easiest to deal with:
404
+ /// Unfortunately the blocking in [`Client:: acquire`] happens at the
405
+ /// implementation layer of jobservers. On Unix this requires a blocking
406
+ /// call to `read` and on Windows this requires one of the `WaitFor*`
407
+ /// functions. Both of these situations aren't the easiest to deal with:
407
408
///
408
409
/// * On Unix there's basically only one way to wake up a `read` early, and
409
410
/// that's through a signal. This is what the `make` implementation
@@ -419,7 +420,7 @@ impl Client {
419
420
/// unfortunately.
420
421
///
421
422
/// This function essentially attempts to ease these limitations by
422
- /// converting this `Client` into a helper thread spawned into this
423
+ /// converting this [ `Client`] into a helper thread spawned into this
423
424
/// process. The application can then request that the helper thread
424
425
/// acquires tokens and the provided closure will be invoked for each token
425
426
/// acquired.
@@ -429,23 +430,23 @@ impl Client {
429
430
///
430
431
/// # Arguments
431
432
///
432
- /// This function will consume the `Client` provided to be transferred to
433
+ /// This function will consume the [ `Client`] provided to be transferred to
433
434
/// the helper thread that is spawned. Additionally a closure `f` is
434
435
/// provided to be invoked whenever a token is acquired.
435
436
///
436
437
/// This closure is only invoked after calls to
437
- /// `HelperThread::request_token` have been made and a token itself has
438
+ /// [ `HelperThread::request_token`] have been made and a token itself has
438
439
/// been acquired. If an error happens while acquiring the token then
439
440
/// an error will be yielded to the closure as well.
440
441
///
441
442
/// # Return Value
442
443
///
443
- /// This function will return an instance of the `HelperThread` structure
444
+ /// This function will return an instance of the [ `HelperThread`] structure
444
445
/// which is used to manage the helper thread associated with this client.
445
- /// Through the `HelperThread` you'll request that tokens are acquired.
446
+ /// Through the [ `HelperThread`] you'll request that tokens are acquired.
446
447
/// When acquired, the closure provided here is invoked.
447
448
///
448
- /// When the `HelperThread` structure is returned it will be gracefully
449
+ /// When the [ `HelperThread`] structure is returned it will be gracefully
449
450
/// torn down, and the calling thread will be blocked until the thread is
450
451
/// torn down (which should be prompt).
451
452
///
@@ -482,19 +483,19 @@ impl Client {
482
483
483
484
/// Blocks the current thread until a token is acquired.
484
485
///
485
- /// This is the same as ` acquire`, except that it doesn't return an RAII
486
- /// helper. If successful the process will need to guarantee that
487
- /// ` release_raw` is called in the future.
486
+ /// This is the same as [`Client:: acquire`] , except that it doesn't return
487
+ /// an RAII helper. If successful the process will need to guarantee that
488
+ /// [`Client:: release_raw`] is called in the future.
488
489
pub fn acquire_raw ( & self ) -> io:: Result < ( ) > {
489
490
self . inner . acquire ( ) ?;
490
491
Ok ( ( ) )
491
492
}
492
493
493
494
/// Releases a jobserver token back to the original jobserver.
494
495
///
495
- /// This is intended to be paired with ` acquire_raw` if it was called, but
496
- /// in some situations it could also be called to relinquish a process's
497
- /// implicit token temporarily which is then re-acquired later.
496
+ /// This is intended to be paired with [`Client:: acquire_raw`] if it was
497
+ /// called, but in some situations it could also be called to relinquish a
498
+ /// process's implicit token temporarily which is then re-acquired later.
498
499
pub fn release_raw ( & self ) -> io:: Result < ( ) > {
499
500
self . inner . release ( None ) ?;
500
501
Ok ( ( ) )
@@ -509,7 +510,7 @@ impl Drop for Acquired {
509
510
}
510
511
}
511
512
512
- /// Structure returned from `Client::into_helper_thread` to manage the lifetime
513
+ /// Structure returned from [ `Client::into_helper_thread`] to manage the lifetime
513
514
/// of the helper thread returned, see those associated docs for more info.
514
515
#[ derive( Debug ) ]
515
516
pub struct HelperThread {
@@ -521,7 +522,7 @@ impl HelperThread {
521
522
/// Request that the helper thread acquires a token, eventually calling the
522
523
/// original closure with a token when it's available.
523
524
///
524
- /// For more information, see the docs on that function .
525
+ /// For more information, see the docs on [`Client::into_helper_thread`] .
525
526
pub fn request_token ( & self ) {
526
527
// Indicate that there's one more request for a token and then wake up
527
528
// the helper thread if it's sleeping.
0 commit comments