docs(rust): updated README to reflect language initialization updates

This commit is contained in:
Antonin Delpeuch 2024-10-06 19:30:05 +02:00 committed by GitHub
parent 94f7a47abd
commit 50bea73ce3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -28,14 +28,14 @@ Then, add a language as a dependency:
```toml
[dependencies]
tree-sitter = "0.22"
tree-sitter-rust = "0.21"
tree-sitter = "0.24"
tree-sitter-rust = "0.23"
```
To then use a language, you assign them to the parser.
```rust
parser.set_language(&tree_sitter_rust::language()).expect("Error loading Rust grammar");
parser.set_language(&tree_sitter_rust::LANGUAGE.into()).expect("Error loading Rust grammar");
```
Now you can parse source code: