Skip to content

Commit 628eab5

Browse files
committed
Update docs
1 parent 4e5cf3e commit 628eab5

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Output will be like this:
7676
### What this library provides
7777

7878
#### Macros to run external commands
79-
- [run_cmd!](https://docs.rs/cmd_lib/latest/cmd_lib/macro.run_cmd.html) -> [CmdResult](https://docs.rs/cmd_lib/latest/cmd_lib/type.CmdResult.html)
79+
- [`run_cmd!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.run_cmd.html) -> [`CmdResult`](https://docs.rs/cmd_lib/latest/cmd_lib/type.CmdResult.html)
8080

8181
```rust
8282
let msg = "I love rust";
@@ -101,7 +101,7 @@ run_cmd! {
101101
}?;
102102
```
103103

104-
- [run_fun!](https://docs.rs/cmd_lib/latest/cmd_lib/macro.run_fun.html) -> [FunResult](https://docs.rs/cmd_lib/latest/cmd_lib/type.FunResult.html)
104+
- [`run_fun!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.run_fun.html) -> [`FunResult`](https://docs.rs/cmd_lib/latest/cmd_lib/type.FunResult.html)
105105

106106
```rust
107107
let version = run_fun!(rustc --version)?;
@@ -228,7 +228,7 @@ run_cmd!(info "This is an infomation message")?;
228228
```
229229

230230
#### 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:
232232

233233
```rust
234234
#[export_cmd(my_cmd)]
@@ -242,16 +242,16 @@ use_custom_cmd!(my_cmd);
242242
run_cmd!(my_cmd)?;
243243
println!("get result: {}", run_fun!(my_cmd)?);
244244
```
245-
246245
#### Low-level process spawning macros
247246

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
249248
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
251250
for the process to finish.
252251

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).
255255

256256
There are also other useful APIs, and you can check the docs for more details.
257257

@@ -278,9 +278,9 @@ spawn_with_output!(journalctl)?.wait_with_pipe(&mut |pipe| {
278278

279279

280280
#### 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
284284
```rust
285285
tls_init!(DELAY, f64, 1.0);
286286
const DELAY_FACTOR: f64 = 0.8;
@@ -325,7 +325,7 @@ You can use the [glob](https://github.com/rust-lang-nursery/glob) package instea
325325

326326
This library tries very hard to not set global states, so parallel `cargo test` can be executed just fine.
327327
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.
329329

330330

331331
License: MIT OR Apache-2.0

src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
//! ## What this library provides
8484
//!
8585
//! ### Macros to run external commands
86-
//! - [run_cmd!](https://docs.rs/cmd_lib/latest/cmd_lib/macro.run_cmd.html) -> [CmdResult](https://docs.rs/cmd_lib/latest/cmd_lib/type.CmdResult.html)
86+
//! - [`run_cmd!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.run_cmd.html) -> [`CmdResult`](https://docs.rs/cmd_lib/latest/cmd_lib/type.CmdResult.html)
8787
//!
8888
//! ```no_run
8989
//! # use cmd_lib::run_cmd;
@@ -110,7 +110,7 @@
110110
//! # Ok::<(), std::io::Error>(())
111111
//! ```
112112
//!
113-
//! - [run_fun!](https://docs.rs/cmd_lib/latest/cmd_lib/macro.run_fun.html) -> [FunResult](https://docs.rs/cmd_lib/latest/cmd_lib/type.FunResult.html)
113+
//! - [`run_fun!`](https://docs.rs/cmd_lib/latest/cmd_lib/macro.run_fun.html) -> [`FunResult`](https://docs.rs/cmd_lib/latest/cmd_lib/type.FunResult.html)
114114
//!
115115
//! ```
116116
//! # use cmd_lib::run_fun;
@@ -251,7 +251,7 @@
251251
//! ```
252252
//!
253253
//! ### Macros to register your own commands
254-
//! 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:
255255
//!
256256
//! ```
257257
//! # use cmd_lib::*;
@@ -268,16 +268,16 @@
268268
//! println!("get result: {}", run_fun!(my_cmd)?);
269269
//! # Ok::<(), std::io::Error>(())
270270
//! ```
271-
//!
272271
//! ### Low-level process spawning macros
273272
//!
274-
//! [`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
275274
//! 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
277276
//! for the process to finish.
278277
//!
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).
281281
//!
282282
//! There are also other useful APIs, and you can check the docs for more details.
283283
//!
@@ -307,9 +307,9 @@
307307
//!
308308
//!
309309
//! ### 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
313313
//! ```
314314
//! # use cmd_lib::{ tls_init, tls_get, tls_set };
315315
//! tls_init!(DELAY, f64, 1.0);
@@ -359,7 +359,7 @@
359359
//!
360360
//! This library tries very hard to not set global states, so parallel `cargo test` can be executed just fine.
361361
//! 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.
363363
//!
364364
365365
pub use cmd_lib_macros::{

0 commit comments

Comments
 (0)