html5ever
html5ever copied to clipboard
doc: how to run example, for n00bs
Re: https://github.com/servo/html5ever/pull/475
- Make sure your
rustc
version is1.61.0
or greaterrustup update rustup override unset rustup default stable rustc --version
- Create a new project
mkdir -p ./my-print-rcdom/ pushd ./my-print-rcdom/ cargo init
- Update
Cargo.toml
to include the dependencies (also,2018
appears to be the required edition)[package] name = "example01" version = "0.1.0" authors = ["Joe Doe <[email protected]>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] html5ever = "0.25.2" markup5ever_rcdom = "0.1.0"
- Replace
src/main.rs
with the contents of, for example,./rcdom/examples/print-rcdom.rs
rm ./src/main.rs curl -L -o ./src/main.rs https://raw.githubusercontent.com/servo/html5ever/1b34cf17c/rcdom/examples/print-rcdom.rs
- Install, build, run (with input):
cargo build curl https://example.com | cargo run
Troubleshooting
Weird bug:
warning: unused import: `html5ever::tendril::TendrilSink`
--> src/main.rs:20:5
|
20 | use html5ever::tendril::TendrilSink;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
Changing the name
field in Cargo.toml
(to anything at all), saving, and running cargo install
again.
A room full of rust developers, including one of the most popular teachers on udemy in the room here with us, cannot figure this out.