Skip to content

Commit 2b01f96

Browse files
committed
Fix example in README, mention pad_with().
1 parent 2f93c1d commit 2b01f96

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ Inspired by the "left-pad" NPM package (and the fiasco that happened after its r
1616

1717
## Example
1818
``` rust
19-
use leftpad_rs::{pad,pad_char};
19+
use leftpad_rs::{pad,pad_char,pad_with};
2020

2121
fn main() {
2222
let s = "foo";
2323

2424
println!("{}", pad(s, 5));
25-
println!("{:?}", pad_char(s, 5, 'b'));
25+
let s1 = match pad_char(s, 6, ' ')) {
26+
Ok(s) => s,
27+
Err(e) => Err("Error: {}", e)
28+
};
29+
println!("{:?}", s1);
2630

2731
// You can use pad_with() too now.
28-
//println!("{:?}", pad_with(s, 5, 'b'));
29-
}
3032
```
3133
## crates.io
3234
You can use this package in your project by adding the following

0 commit comments

Comments
 (0)