You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -228,7 +228,7 @@ run_cmd!(info "This is an infomation message")?;
228
228
```
229
229
230
230
#### Macros to register your own commands
231
-
Declare your function with `#[export_cmd(..)]` attribute, and import it with [`use_custom_cmd!`] macro:
231
+
Declare your function with `#[export_cmd(..)]` attribute, and import it with [`use_custom_cmd!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.use_custom_cmd.html) macro:
232
232
233
233
```rust
234
234
#[export_cmd(my_cmd)]
@@ -242,16 +242,16 @@ use_custom_cmd!(my_cmd);
242
242
run_cmd!(my_cmd)?;
243
243
println!("get result: {}", run_fun!(my_cmd)?);
244
244
```
245
-
246
245
#### Low-level process spawning macros
247
246
248
-
[`spawn!`] macro executes the whole command as a child process, returning a handle to it. By
247
+
[`spawn!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.spawn.html) macro executes the whole command as a child process, returning a handle to it. By
249
248
default, stdin, stdout and stderr are inherited from the parent. The process will run in the
250
-
background, so you can run other stuff concurrently. You can call [`wait()`](`CmdChildren::wait()`) to wait
249
+
background, so you can run other stuff concurrently. You can call [`wait()`](https://docs.rs/cmd_lib/latest/cmd_lib/struct.CmdChildren.html#method.wait) to wait
251
250
for the process to finish.
252
251
253
-
With [`spawn_with_output!`] you can get output by calling [`wait_with_output()`](`FunChildren::wait_with_output()`), or even do stream
254
-
processing with [`wait_with_pipe()`](`FunChildren::wait_with_pipe()`).
252
+
With [`spawn_with_output!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.spawn_with_output.html) you can get output by calling
253
+
[`wait_with_output()`](https://docs.rs/cmd_lib/latest/cmd_lib/struct.FunChildren.html#method.wait_with_output), or even do stream
254
+
processing with [`wait_with_pipe()`](https://docs.rs/cmd_lib/latest/cmd_lib/struct.FunChildren.html#method.wait_with_pipe).
255
255
256
256
There are also other useful APIs, and you can check the docs for more details.
#### Macros to define, get and set thread-local global variables
281
-
-[`tls_init!`] to define thread local global variable
282
-
-[`tls_get!`] to get the value
283
-
-[`tls_set!`] to set the value
281
+
-[`tls_init!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_init.html) to define thread local global variable
282
+
-[`tls_get!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_get.html) to get the value
283
+
-[`tls_set!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_set.html) to set the value
284
284
```rust
285
285
tls_init!(DELAY, f64, 1.0);
286
286
constDELAY_FACTOR:f64=0.8;
@@ -325,7 +325,7 @@ You can use the [glob](https://github.com/rust-lang-nursery/glob) package instea
325
325
326
326
This library tries very hard to not set global states, so parallel `cargo test` can be executed just fine.
327
327
The only known APIs not supported in multi-thread environment are the
328
-
[`tls_init`]/[`tls_get`]/[`tls_set`] macros, and you should only use them for *thread local* variables.
328
+
[`tls_init!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_init.html)/[`tls_get!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_get.html)/[`tls_set!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_set.html) macros, and you should only use them for *thread local* variables.
//! Declare your function with `#[export_cmd(..)]` attribute, and import it with [`use_custom_cmd!`] macro:
254
+
//! Declare your function with `#[export_cmd(..)]` attribute, and import it with [`use_custom_cmd!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.use_custom_cmd.html) macro:
//! [`spawn!`] macro executes the whole command as a child process, returning a handle to it. By
273
+
//! [`spawn!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.spawn.html) macro executes the whole command as a child process, returning a handle to it. By
275
274
//! default, stdin, stdout and stderr are inherited from the parent. The process will run in the
276
-
//! background, so you can run other stuff concurrently. You can call [`wait()`](`CmdChildren::wait()`) to wait
275
+
//! background, so you can run other stuff concurrently. You can call [`wait()`](https://docs.rs/cmd_lib/latest/cmd_lib/struct.CmdChildren.html#method.wait) to wait
277
276
//! for the process to finish.
278
277
//!
279
-
//! With [`spawn_with_output!`] you can get output by calling [`wait_with_output()`](`FunChildren::wait_with_output()`), or even do stream
280
-
//! processing with [`wait_with_pipe()`](`FunChildren::wait_with_pipe()`).
278
+
//! With [`spawn_with_output!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.spawn_with_output.html) you can get output by calling
279
+
//! [`wait_with_output()`](https://docs.rs/cmd_lib/latest/cmd_lib/struct.FunChildren.html#method.wait_with_output), or even do stream
280
+
//! processing with [`wait_with_pipe()`](https://docs.rs/cmd_lib/latest/cmd_lib/struct.FunChildren.html#method.wait_with_pipe).
281
281
//!
282
282
//! There are also other useful APIs, and you can check the docs for more details.
283
283
//!
@@ -307,9 +307,9 @@
307
307
//!
308
308
//!
309
309
//! ### Macros to define, get and set thread-local global variables
310
-
//! - [`tls_init!`] to define thread local global variable
311
-
//! - [`tls_get!`] to get the value
312
-
//! - [`tls_set!`] to set the value
310
+
//! - [`tls_init!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_init.html) to define thread local global variable
311
+
//! - [`tls_get!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_get.html) to get the value
312
+
//! - [`tls_set!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_set.html) to set the value
313
313
//! ```
314
314
//! # use cmd_lib::{ tls_init, tls_get, tls_set };
315
315
//! tls_init!(DELAY, f64, 1.0);
@@ -359,7 +359,7 @@
359
359
//!
360
360
//! This library tries very hard to not set global states, so parallel `cargo test` can be executed just fine.
361
361
//! The only known APIs not supported in multi-thread environment are the
362
-
//! [`tls_init`]/[`tls_get`]/[`tls_set`] macros, and you should only use them for *thread local* variables.
362
+
//! [`tls_init!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_init.html)/[`tls_get!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_get.html)/[`tls_set!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.tls_set.html) macros, and you should only use them for *thread local* variables.
0 commit comments