Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mdrokz/auto_generate_cdp
experimental crate to generate the Chrome Devtools Protocol.
https://github.com/mdrokz/auto_generate_cdp
build-tool cdp chrome devtools-protocol generation json json-schema macros rust specification
Last synced: 2 days ago
JSON representation
experimental crate to generate the Chrome Devtools Protocol.
- Host: GitHub
- URL: https://github.com/mdrokz/auto_generate_cdp
- Owner: mdrokz
- License: gpl-3.0
- Created: 2021-04-27T15:51:17.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-26T12:25:01.000Z (12 months ago)
- Last Synced: 2024-05-01T16:29:03.564Z (7 months ago)
- Topics: build-tool, cdp, chrome, devtools-protocol, generation, json, json-schema, macros, rust, specification
- Language: Rust
- Homepage:
- Size: 225 KB
- Stars: 14
- Watchers: 2
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# auto_generate_cdp
[![Docs](https://docs.rs/auto_generate_cdp/badge.svg)](https://docs.rs/auto_generate_cdp)
[![Crates.io](https://img.shields.io/crates/v/auto_generate_cdp.svg?maxAge=2592000)](https://crates.io/crates/auto_generate_cdp)An experimental crate to generate the Chrome Devtools Protocol.
[![Contributors](https://img.shields.io/github/contributors/mdrokz/auto_generate_cdp.svg)](https://github.com/mdrokz/auto_generate_cdp/graphs/contributors)
# Usage
Add the following to your `Cargo.toml`:
```toml
[dependencies]
serde = {version = "1", features = ["derive"]}
serde_json = '1'[build-dependencies]
auto_generate_cdp = {version = "0.4.4",default-features = false}
```To generate the protocol, add the following to your `build/build.rs` script.
```rust
use auto_generate_cdp::init;fn main() {
init();
}
```This will generate `protocol.rs` in your `$OUT_DIR` folder when you run `$ cargo check` or `$ cargo build`. Use like:
```rust
// src/protocol.rsinclude!(concat!(env!("OUT_DIR"), "/protocol.rs"));
```
```rust
// src/main.rsmod protocol;
fn main() {
// protocol module contains the definitions now
}
```## Compiling behind a firewall
auto_generate_cdp needs to fetch files from `raw.githubusercontent.com` during compilation.
If for whatever reason you cannot access `raw.githubusercontent.com` directly
(e.g. corporate firewall and/or internet censorship), you can try using a proxy server
by setting any one of the following environment variables: `https_proxy`, `http_proxy`,
`ALL_PROXY`. For example:```sh
# proxy server uses curl format
https_proxy=http://localhost:8080 cargo build
```