pub enum QueryConfig {
TreeSitter(String),
Structured {
format: QueryFormat,
query: String,
strip: Option<String>,
template: Option<String>,
},
}Expand description
A named query — either a raw tree-sitter S-expression string, or a table with an explicit format and optional post-processing.
# Simple tree-sitter query (string form — no post-processing)
[preprocessor.treesitter.rust.queries]
struct = "(struct_item name: (type_identifier) @name) @struct"
# Tree-sitter query with a strip regex (table form, format defaults to treesitter)
[preprocessor.treesitter.rust.queries.comment_text]
query = "((line_comment)+ @doc_comment ...)"
strip = "^///? ?"
# jq query (table form with explicit format)
[preprocessor.treesitter.rust.queries.doc_comment_jq]
format = "jq"
query = ".children[] | select(.type == \"struct_item\") | ..."Variants§
TreeSitter(String)
A plain tree-sitter S-expression query string (no strip).
Structured
A structured query: format defaults to treesitter when omitted.
The optional strip field is a regex applied to every output line —
matches are removed, which lets you strip comment delimiters, braces,
leading whitespace, etc.
Fields
§
format: QueryFormat§
template: Option<String>Output template applied once per query match.
Use {capture_name} placeholders to interpolate captured text.
When multiple nodes are captured under the same name (e.g. (line_comment)+),
they are joined with \n before substitution. The strip regex,
if present, is applied to each capture’s text before substitution.
[preprocessor.treesitter.rust.queries.enum_variants]
query = "((line_comment)+ @doc_comment . (enum_variant name: (identifier) @name))"
strip = "^///? ?"
template = "- {name}: {doc_comment}"Implementations§
Trait Implementations§
Source§impl Clone for QueryConfig
impl Clone for QueryConfig
Source§fn clone(&self) -> QueryConfig
fn clone(&self) -> QueryConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QueryConfig
impl Debug for QueryConfig
Source§impl<'de> Deserialize<'de> for QueryConfig
impl<'de> Deserialize<'de> for QueryConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for QueryConfig
impl RefUnwindSafe for QueryConfig
impl Send for QueryConfig
impl Sync for QueryConfig
impl Unpin for QueryConfig
impl UnsafeUnpin for QueryConfig
impl UnwindSafe for QueryConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more