tss-rust 0.1.0

Generated node type enums and metadata from tree-sitter-rust
Documentation

tss-rust

crates.io documentation MIT licensed

Generated node type enums and metadata from tree-sitter-rust.

Usage

[dependencies]
tss-rust = "0.1"
tree-sitter = "0.24"
tree-sitter-rust = "0.24"
use tree_sitter_symbols_rust::NodeType;
use std::str::FromStr;

let node_type = NodeType::from_str("function_item")?;
assert_eq!(node_type, NodeType::FunctionItem);
assert_eq!(node_type.to_string(), "function_item");

Features

Default includes all metadata:

tss-rust = "0.1"

Select specific metadata:

tss-rust = { version = "0.1", default-features = false, features = ["meta-named", "meta-fields"] }

Available metadata features:

  • meta-named - whether nodes are named in the grammar
  • meta-subtypes - possible subtypes for each node
  • meta-fields - named fields nodes can have
  • meta-children - anonymous children nodes can have
  • meta-extra - extra node markers
  • meta-root - root node markers

How It Works

At build time, reads tree-sitter-rust's NODE_TYPES constant and generates:

  • A NodeType enum with all 280+ node types
  • FromStr for parsing node type strings
  • Display for converting back to strings
  • Documentation linking to Rust language reference

Zero runtime dependencies - all generation happens at compile time.

Licensing

MIT licensed - see LICENSE for details.