mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:26:23 -04:00
Fix Rust bindings example (#415)
`Parser::parse` returns `Option<&Tree>`. An `unwrap()` or similar is required to get the actual `Tree`.
This commit is contained in:
parent
93f7de03e2
commit
b1a4cc044d
|
|
@ -34,7 +34,7 @@ Now you can parse source code:
|
|||
|
||||
```rust
|
||||
let source_code = "fn test() {}";
|
||||
let tree = parser.parse(source_code, None);
|
||||
let tree = parser.parse(source_code, None).unwrap();
|
||||
let root_node = tree.root_node();
|
||||
|
||||
assert_eq!(root_node.kind(), "source_file");
|
||||
|
|
|
|||
Loading…
Reference in a new issue