6
6
7
7
A snippet extractor for competitive programmers.
8
8
9
- You can manage code snippet with test and bench !!
9
+ This allows you to manage your code snippets with tests and benchmarks available !!
10
10
11
11
## Installing
12
12
@@ -27,22 +27,20 @@ $ cargo install cargo-snippet --features="binaries"
27
27
Create a project for snippet.
28
28
29
29
```
30
- $ cargo new mysnippet
30
+ $ cargo new --lib mysnippet
31
31
```
32
32
33
33
Add dependencies to Cargo.toml.
34
34
35
35
``` toml
36
36
[dependencies ]
37
- cargo-snippet = " 0.5 "
37
+ cargo-snippet = " 0.6 "
38
38
```
39
39
40
- Add this to src/lib.rs.
40
+ Note: ` cargo-snippet ` on dependencies is needed just for register ` #[snippet] ` attribute to prevent the error from the compiler.
41
+ All logics that extract snippet is in the binary package which is installed by ` Installing ` section.
41
42
42
- Note: ` cargo-snippet ` on dependencies is needed just for register ` #[snippet] ` attribute to prevent error from the compiler.
43
- All logic that extract snippet is in binary package which is installed by ` Installing ` section.
44
-
45
- Write some snippet codes and tests.
43
+ Then write some snippet codes and tests.
46
44
47
45
``` rust
48
46
use cargo_snippet :: snippet;
@@ -86,7 +84,7 @@ fn documented() {
86
84
// ! Inner document also works.
87
85
}
88
86
89
- // If you want it to be hidden, append `doc_hidden` keyword.
87
+ // If you want doc comment to be hidden, append `doc_hidden` keyword.
90
88
#[snippet(doc_hidden, prefix = " use std::collections::HashMap;" )]
91
89
/// This is a doc comment for `bar`.
92
90
/// Since `doc_hidden` is specified, it won't be present in the snippet.
@@ -105,7 +103,7 @@ fn test_lcm() {
105
103
}
106
104
```
107
105
108
- You can test.
106
+ You can test as always:
109
107
110
108
```
111
109
$ cargo test
0 commit comments