Skip to content

Commit

Permalink
Improve README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
aDotInTheVoid committed Jul 6, 2024
1 parent 17cbe9f commit 5ae42b8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
# Rustdoc Types

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

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

## Release Procedure
```rust
let json_string = std::fs::read_to_string("./target/doc/rustdoc_types.json")?;
let krate: rustdoc_types::Crate = serde_json::from_str(&json_string)?;

println!("the index has {} items", krate.index.len());
```

## Contributing

This repo is a reexport of
[`rustdoc-json-types`](https://github.com/rust-lang/rust/blob/master/src/rustdoc-json-types/lib.rs)
from the rust repo. Any change to the contents of [`src/`](src/), should be sent
to [`rust-lang/rust`](https://github.com/rust-lang/rust/), via their [normal
contibution
procudures](https://rustc-dev-guide.rust-lang.org/contributing.html). Once
reviewed and merged there, the change will be pulled to this repo and published
to crates.io.

### Release Procedure

1. Run `./update.sh` to pull code from upstream
2. Run `cargo test`
3. Run `./clgen.sh <old_version> <new_version>`
4. Follow instructions to commit and push.
4. Follow printed instructions to commit and push.

## License

Expand All @@ -22,7 +42,7 @@ Licensed under either of

at your option.

## Contribution
### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
Expand Down
9 changes: 9 additions & 0 deletions examples/simple_usage.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
let json_string = std::fs::read_to_string("./target/doc/rustdoc_types.json")?;
let krate: rustdoc_types::Crate = serde_json::from_str(&json_string)?;
println!("the index has {} items", krate.index.len());

Ok(())
}

0 comments on commit 5ae42b8

Please sign in to comment.