Skip to content

Commit 5ae42b8

Browse files
committed
Improve README.md
1 parent 17cbe9f commit 5ae42b8

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,35 @@
11
# Rustdoc Types
22

3-
[Docs](https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc_json_types/index.html)
3+
[Docs](https://docs.rs/rustdoc-types/latest/rustdoc_types/)
44

5-
This is an export of [`rustdoc-json-types`](https://github.com/rust-lang/rust/blob/master/src/rustdoc-json-types/lib.rs)
5+
This crate contains the type definiions for rustdoc's currently-unstable
6+
`--output-format=json` flag. They can be deserialized with `serde-json` from
7+
the output of `cargo +nightly rustdoc -- --output-format json -Z unstable-options`:
68

7-
## Release Procedure
9+
```rust
10+
let json_string = std::fs::read_to_string("./target/doc/rustdoc_types.json")?;
11+
let krate: rustdoc_types::Crate = serde_json::from_str(&json_string)?;
12+
13+
println!("the index has {} items", krate.index.len());
14+
```
15+
16+
## Contributing
17+
18+
This repo is a reexport of
19+
[`rustdoc-json-types`](https://github.com/rust-lang/rust/blob/master/src/rustdoc-json-types/lib.rs)
20+
from the rust repo. Any change to the contents of [`src/`](src/), should be sent
21+
to [`rust-lang/rust`](https://github.com/rust-lang/rust/), via their [normal
22+
contibution
23+
procudures](https://rustc-dev-guide.rust-lang.org/contributing.html). Once
24+
reviewed and merged there, the change will be pulled to this repo and published
25+
to crates.io.
26+
27+
### Release Procedure
828

929
1. Run `./update.sh` to pull code from upstream
1030
2. Run `cargo test`
1131
3. Run `./clgen.sh <old_version> <new_version>`
12-
4. Follow instructions to commit and push.
32+
4. Follow printed instructions to commit and push.
1333

1434
## License
1535

@@ -22,7 +42,7 @@ Licensed under either of
2242

2343
at your option.
2444

25-
## Contribution
45+
### Contribution
2646

2747
Unless you explicitly state otherwise, any contribution intentionally submitted
2848
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be

examples/simple_usage.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use std::error::Error;
2+
3+
fn main() -> Result<(), Box<dyn Error>> {
4+
let json_string = std::fs::read_to_string("./target/doc/rustdoc_types.json")?;
5+
let krate: rustdoc_types::Crate = serde_json::from_str(&json_string)?;
6+
println!("the index has {} items", krate.index.len());
7+
8+
Ok(())
9+
}

0 commit comments

Comments
 (0)