29
29
//!
30
30
//! // See API documentation for why this is `unsafe`
31
31
//! let client = match unsafe { Client::from_env() } {
32
- //! Ok (client) => client,
33
- //! Err(_) => panic!("client not configured"),
32
+ //! Some (client) => client,
33
+ //! None => panic!("client not configured"),
34
34
//! };
35
35
//! ```
36
36
//!
@@ -269,7 +269,7 @@ impl Client {
269
269
///
270
270
/// Note, though, that on Windows it should be safe to call this function
271
271
/// any number of times.
272
- pub unsafe fn from_env ( ) -> Result < Client , ErrFromEnv > {
272
+ pub unsafe fn from_env_ext ( ) -> Result < Client , ErrFromEnv > {
273
273
let ( env, var) = [ "CARGO_MAKEFLAGS" , "MAKEFLAGS" , "MFLAGS" ]
274
274
. iter ( )
275
275
. map ( |& env| env:: var ( env) . map ( |var| ( env, var) ) )
@@ -289,6 +289,14 @@ impl Client {
289
289
}
290
290
}
291
291
292
+ /// Attempts to connect to the jobserver specified in this process's
293
+ /// environment.
294
+ ///
295
+ /// Wraps `from_env_ext` and discards error details.
296
+ pub unsafe fn from_env ( ) -> Option < Client > {
297
+ Self :: from_env_ext ( ) . ok ( )
298
+ }
299
+
292
300
/// Acquires a token from this jobserver client.
293
301
///
294
302
/// This function will block the calling thread until a new token can be
0 commit comments