difftastic/rustdoc/tree_sitter/struct.Parser.html

234 lines
62 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A stateful object that this is used to produce a `Tree` based on some source code."><title>Parser in tree_sitter - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="tree_sitter" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../tree_sitter/index.html">tree_sitter</a><span class="version">0.25.10</span></h2></div><h2 class="location"><a href="#">Parser</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.cancellation_flag">cancellation_flag</a></li><li><a href="#method.from_raw">from_raw</a></li><li><a href="#method.included_ranges">included_ranges</a></li><li><a href="#method.into_raw">into_raw</a></li><li><a href="#method.language">language</a></li><li><a href="#method.logger">logger</a></li><li><a href="#method.new">new</a></li><li><a href="#method.parse">parse</a></li><li><a href="#method.parse_custom_encoding">parse_custom_encoding</a></li><li><a href="#method.parse_utf16">parse_utf16</a></li><li><a href="#method.parse_utf16_be">parse_utf16_be</a></li><li><a href="#method.parse_utf16_be_with_options">parse_utf16_be_with_options</a></li><li><a href="#method.parse_utf16_le">parse_utf16_le</a></li><li><a href="#method.parse_utf16_le_with_options">parse_utf16_le_with_options</a></li><li><a href="#method.parse_utf16_with">parse_utf16_with</a></li><li><a href="#method.parse_with">parse_with</a></li><li><a href="#method.parse_with_options">parse_with_options</a></li><li><a href="#method.print_dot_graphs">print_dot_graphs</a></li><li><a href="#method.reset">reset</a></li><li><a href="#method.set_cancellation_flag">set_cancellation_flag</a></li><li><a href="#method.set_included_ranges">set_included_ranges</a></li><li><a href="#method.set_language">set_language</a></li><li><a href="#method.set_logger">set_logger</a></li><li><a href="#method.set_timeout_micros">set_timeout_micros</a></li><li><a href="#method.stop_printing_dot_graphs">stop_printing_dot_graphs</a></li><li><a href="#method.timeout_micros">timeout_micros</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Default-for-Parser">Default</a></li><li><a href="#impl-Drop-for-Parser">Drop</a></li><li><a href="#impl-Send-for-Parser">Send</a></li><li><a href="#impl-Sync-for-Parser">Sync</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-Parser">RefUnwindSafe</a></li><li><a href="#impl-Unpin-for-Parser">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Parser">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-T">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-T">Into&lt;U&gt;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In crate tree_sitter</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../tree_sitter/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="index.html">tree_sitter</a>::<wbr><a class="struct" href="#">Parser</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../src/tree_sitter/lib.rs.html#133">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct Parser(<span class="comment">/* private fields */</span>);</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A stateful object that this is used to produce a <a href="struct.Tree.html" title="struct tree_sitter::Tree"><code>Tree</code></a> based on some
source code.</p>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Parser" class="impl"><a class="src rightside" href="../src/tree_sitter/ffi.rs.html#49-71">source</a><a href="#impl-Parser" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Parser.html" title="struct tree_sitter::Parser">Parser</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_raw" class="method"><a class="src rightside" href="../src/tree_sitter/ffi.rs.html#56-58">source</a><h4 class="code-header">pub const unsafe fn <a href="#method.from_raw" class="fn">from_raw</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.pointer.html">*mut </a><a class="struct" href="ffi/struct.TSParser.html" title="struct tree_sitter::ffi::TSParser">TSParser</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Reconstructs a <a href="struct.Parser.html" title="struct tree_sitter::Parser"><code>Parser</code></a> from a raw pointer.</p>
<h5 id="safety"><a href="#safety">Safety</a></h5>
<p><code>ptr</code> must be non-null.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_raw" class="method"><a class="src rightside" href="../src/tree_sitter/ffi.rs.html#68-70">source</a><h4 class="code-header">pub fn <a href="#method.into_raw" class="fn">into_raw</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.pointer.html">*mut </a><a class="struct" href="ffi/struct.TSParser.html" title="struct tree_sitter::ffi::TSParser">TSParser</a></h4></section></summary><div class="docblock"><p>Consumes the <a href="struct.Parser.html" title="struct tree_sitter::Parser"><code>Parser</code></a>, returning a raw pointer to the underlying C structure.</p>
<h5 id="safety-1"><a href="#safety-1">Safety</a></h5>
<p>Its a caller responsibility to adjust parsers state
like disable logging or dot graphs printing if this
may cause issues like use after free.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Parser-1" class="impl"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#646-1430">source</a><a href="#impl-Parser-1" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Parser.html" title="struct tree_sitter::Parser">Parser</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#650-655">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Create a new parser.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_language" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#666-676">source</a><h4 class="code-header">pub fn <a href="#method.set_language" class="fn">set_language</a>(&amp;mut self, language: &amp;<a class="struct" href="struct.Language.html" title="struct tree_sitter::Language">Language</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.unit.html">()</a>, <a class="struct" href="struct.LanguageError.html" title="struct tree_sitter::LanguageError">LanguageError</a>&gt;</h4></section></summary><div class="docblock"><p>Set the language that the parser should use for parsing.</p>
<p>Returns a Result indicating whether or not the language was successfully
assigned. True means assignment succeeded. False means there was a
version mismatch: the language was generated with an incompatible
version of the Tree-sitter CLI. Check the languages version using
<a href="struct.Language.html#method.version" title="method tree_sitter::Language::version"><code>Language::version</code></a> and compare it to this librarys
<a href="constant.LANGUAGE_VERSION.html" title="constant tree_sitter::LANGUAGE_VERSION"><code>LANGUAGE_VERSION</code></a> and <a href="constant.MIN_COMPATIBLE_LANGUAGE_VERSION.html" title="constant tree_sitter::MIN_COMPATIBLE_LANGUAGE_VERSION"><code>MIN_COMPATIBLE_LANGUAGE_VERSION</code></a> constants.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.language" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#681-684">source</a><h4 class="code-header">pub fn <a href="#method.language" class="fn">language</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.LanguageRef.html" title="struct tree_sitter::LanguageRef">LanguageRef</a>&lt;'_&gt;&gt;</h4></section></summary><div class="docblock"><p>Get the parsers current language.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.logger" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#689-692">source</a><h4 class="code-header">pub fn <a href="#method.logger" class="fn">logger</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="enum" href="enum.LogType.html" title="enum tree_sitter::LogType">LogType</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) + '_&gt;&gt;</h4></section></summary><div class="docblock"><p>Get the parsers current logger.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_logger" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#696-735">source</a><h4 class="code-header">pub fn <a href="#method.set_logger" class="fn">set_logger</a>(&amp;mut self, logger: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="enum" href="enum.LogType.html" title="enum tree_sitter::LogType">LogType</a>, &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) + '_&gt;&gt;)</h4></section></summary><div class="docblock"><p>Set the logging callback that the parser should use during parsing.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.print_dot_graphs" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#745-765">source</a><h4 class="code-header">pub fn <a href="#method.print_dot_graphs" class="fn">print_dot_graphs</a>(&amp;mut self, file: &amp;impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/std/os/fd/raw/trait.AsRawFd.html" title="trait std::os::fd::raw::AsRawFd">AsRawFd</a>)</h4></section></summary><div class="docblock"><p>Set the destination to which the parser should write debugging graphs
during parsing. The graphs are formatted in the DOT language. You may
want to pipe these graphs directly to a <code>dot(1)</code> process in order to
generate SVG output.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.stop_printing_dot_graphs" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#772-774">source</a><h4 class="code-header">pub fn <a href="#method.stop_printing_dot_graphs" class="fn">stop_printing_dot_graphs</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Stop the parser from printing debugging graphs while parsing.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#789-797">source</a><h4 class="code-header">pub fn <a href="#method.parse" class="fn">parse</a>(
&amp;mut self,
text: impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]&gt;,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section></summary><div class="docblock"><p>Parse a slice of UTF8 text.</p>
<h5 id="arguments"><a href="#arguments">Arguments:</a></h5>
<ul>
<li><code>text</code> The UTF8-encoded text to parse.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
</ul>
<p>Returns a <a href="struct.Tree.html" title="struct tree_sitter::Tree"><code>Tree</code></a> if parsing succeeded, or <code>None</code> if:</p>
<ul>
<li>The parser has not yet had a language assigned with <a href="struct.Parser.html#method.set_language" title="method tree_sitter::Parser::set_language"><code>Parser::set_language</code></a></li>
<li>The timeout set with <a href="struct.Parser.html#method.set_timeout_micros" title="method tree_sitter::Parser::set_timeout_micros"><code>Parser::set_timeout_micros</code></a> expired (deprecated)</li>
<li>The cancellation flag set with <a href="struct.Parser.html#method.set_cancellation_flag" title="method tree_sitter::Parser::set_cancellation_flag"><code>Parser::set_cancellation_flag</code></a> was flipped (deprecated)</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_utf16" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#807-819">source</a><h4 class="code-header">pub fn <a href="#method.parse_utf16" class="fn">parse_utf16</a>(
&amp;mut self,
input: impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u16.html">u16</a>]&gt;,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.25.0: Prefer parse_utf16_le instead</span></div></span></summary><div class="docblock"><p>Parse a slice of UTF16 text.</p>
<h5 id="arguments-1"><a href="#arguments-1">Arguments:</a></h5>
<ul>
<li><code>text</code> The UTF16-encoded text to parse.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_with" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#832-838">source</a><h4 class="code-header">pub fn <a href="#method.parse_with" class="fn">parse_with</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]&gt;, F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Point.html" title="struct tree_sitter::Point">Point</a>) -&gt; T&gt;(
&amp;mut self,
callback: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut F</a>,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.25.0: Prefer <code>parse_with_options</code> instead</span></div></span></summary><div class="docblock"><p>Parse UTF8 text provided in chunks by a callback.</p>
<h5 id="arguments-2"><a href="#arguments-2">Arguments:</a></h5>
<ul>
<li><code>callback</code> A function that takes a byte offset and position and returns a slice of
UTF8-encoded text starting at that byte offset and position. The slices can be of any
length. If the given position is at the end of the text, the callback should return an
empty slice.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_with_options" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#851-928">source</a><h4 class="code-header">pub fn <a href="#method.parse_with_options" class="fn">parse_with_options</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]&gt;, F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Point.html" title="struct tree_sitter::Point">Point</a>) -&gt; T&gt;(
&amp;mut self,
callback: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut F</a>,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;,
options: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.ParseOptions.html" title="struct tree_sitter::ParseOptions">ParseOptions</a>&lt;'_&gt;&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section></summary><div class="docblock"><p>Parse text provided in chunks by a callback.</p>
<h5 id="arguments-3"><a href="#arguments-3">Arguments:</a></h5>
<ul>
<li><code>callback</code> A function that takes a byte offset and position and returns a slice of
UTF8-encoded text starting at that byte offset and position. The slices can be of any
length. If the given position is at the end of the text, the callback should return an
empty slice.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
<li><code>options</code> Options for parsing the text. This can be used to set a progress callback.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_utf16_with" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#944-950">source</a><h4 class="code-header">pub fn <a href="#method.parse_utf16_with" class="fn">parse_utf16_with</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u16.html">u16</a>]&gt;, F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Point.html" title="struct tree_sitter::Point">Point</a>) -&gt; T&gt;(
&amp;mut self,
callback: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut F</a>,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.25.0: Prefer <code>parse_utf16_le_with_options</code> instead</span></div></span></summary><div class="docblock"><p>Parse UTF16 text provided in chunks by a callback.</p>
<h5 id="arguments-4"><a href="#arguments-4">Arguments:</a></h5>
<ul>
<li><code>callback</code> A function that takes a code point offset and position and returns a slice of
UTF16-encoded text starting at that byte offset and position. The slices can be of any
length. If the given position is at the end of the text, the callback should return an
empty slice.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_utf16_le" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#959-971">source</a><h4 class="code-header">pub fn <a href="#method.parse_utf16_le" class="fn">parse_utf16_le</a>(
&amp;mut self,
input: impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u16.html">u16</a>]&gt;,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section></summary><div class="docblock"><p>Parse a slice of UTF16 little-endian text.</p>
<h5 id="arguments-5"><a href="#arguments-5">Arguments:</a></h5>
<ul>
<li><code>text</code> The UTF16-encoded text to parse.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_utf16_le_with_options" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#984-1066">source</a><h4 class="code-header">pub fn <a href="#method.parse_utf16_le_with_options" class="fn">parse_utf16_le_with_options</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u16.html">u16</a>]&gt;, F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Point.html" title="struct tree_sitter::Point">Point</a>) -&gt; T&gt;(
&amp;mut self,
callback: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut F</a>,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;,
options: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.ParseOptions.html" title="struct tree_sitter::ParseOptions">ParseOptions</a>&lt;'_&gt;&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section></summary><div class="docblock"><p>Parse UTF16 little-endian text provided in chunks by a callback.</p>
<h5 id="arguments-6"><a href="#arguments-6">Arguments:</a></h5>
<ul>
<li><code>callback</code> A function that takes a code point offset and position and returns a slice of
UTF16-encoded text starting at that byte offset and position. The slices can be of any
length. If the given position is at the end of the text, the callback should return an
empty slice.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
<li><code>options</code> Options for parsing the text. This can be used to set a progress callback.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_utf16_be" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1075-1087">source</a><h4 class="code-header">pub fn <a href="#method.parse_utf16_be" class="fn">parse_utf16_be</a>(
&amp;mut self,
input: impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u16.html">u16</a>]&gt;,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section></summary><div class="docblock"><p>Parse a slice of UTF16 big-endian text.</p>
<h5 id="arguments-7"><a href="#arguments-7">Arguments:</a></h5>
<ul>
<li><code>text</code> The UTF16-encoded text to parse.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_utf16_be_with_options" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1100-1183">source</a><h4 class="code-header">pub fn <a href="#method.parse_utf16_be_with_options" class="fn">parse_utf16_be_with_options</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u16.html">u16</a>]&gt;, F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Point.html" title="struct tree_sitter::Point">Point</a>) -&gt; T&gt;(
&amp;mut self,
callback: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut F</a>,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;,
options: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.ParseOptions.html" title="struct tree_sitter::ParseOptions">ParseOptions</a>&lt;'_&gt;&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section></summary><div class="docblock"><p>Parse UTF16 big-endian text provided in chunks by a callback.</p>
<h5 id="arguments-8"><a href="#arguments-8">Arguments:</a></h5>
<ul>
<li><code>callback</code> A function that takes a code point offset and position and returns a slice of
UTF16-encoded text starting at that byte offset and position. The slices can be of any
length. If the given position is at the end of the text, the callback should return an
empty slice.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
<li><code>options</code> Options for parsing the text. This can be used to set a progress callback.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_custom_encoding" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1201-1291">source</a><h4 class="code-header">pub fn <a href="#method.parse_custom_encoding" class="fn">parse_custom_encoding</a>&lt;D: <a class="trait" href="trait.Decode.html" title="trait tree_sitter::Decode">Decode</a>, T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]&gt;, F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Point.html" title="struct tree_sitter::Point">Point</a>) -&gt; T&gt;(
&amp;mut self,
callback: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut F</a>,
old_tree: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;,
options: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.ParseOptions.html" title="struct tree_sitter::ParseOptions">ParseOptions</a>&lt;'_&gt;&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Tree.html" title="struct tree_sitter::Tree">Tree</a>&gt;</h4></section></summary><div class="docblock"><p>Parse text provided in chunks by a callback using a custom encoding.
This is useful for parsing text in encodings that are not UTF-8 or UTF-16.</p>
<h5 id="arguments-9"><a href="#arguments-9">Arguments:</a></h5>
<ul>
<li><code>callback</code> A function that takes a byte offset and position and returns a slice of text
starting at that byte offset and position. The slices can be of any length. If the given
position is at the end of the text, the callback should return an empty slice.</li>
<li><code>old_tree</code> A previous syntax tree parsed from the same document. If the text of the
document has changed since <code>old_tree</code> was created, then you must edit <code>old_tree</code> to match
the new text using <a href="struct.Tree.html#method.edit" title="method tree_sitter::Tree::edit"><code>Tree::edit</code></a>.</li>
<li><code>options</code> Options for parsing the text. This can be used to set a progress callback.</li>
</ul>
<p>Additionally, you must set the generic parameter [<code>D</code>] to a type that implements the
<a href="trait.Decode.html" title="trait tree_sitter::Decode"><code>Decode</code></a> trait. This trait has a single method, <a href="trait.Decode.html#tymethod.decode" title="associated function tree_sitter::Decode::decode"><code>decode</code></a>, which takes a
slice of bytes and returns a tuple of the code point and the number of bytes consumed.
The <code>decode</code> method should return <code>-1</code> for the code point if decoding fails.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reset" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1301-1303">source</a><h4 class="code-header">pub fn <a href="#method.reset" class="fn">reset</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Instruct the parser to start the next parse from the beginning.</p>
<p>If the parser previously failed because of a timeout, cancellation,
or callback, then by default, it will resume where it left off on the
next call to <a href="struct.Parser.html#method.parse" title="method tree_sitter::Parser::parse"><code>parse</code></a> or other parsing functions.
If you dont want to resume, and instead intend to use this parser to
parse some other document, you must call <code>reset</code> first.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timeout_micros" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1314-1316">source</a><h4 class="code-header">pub fn <a href="#method.timeout_micros" class="fn">timeout_micros</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u64.html">u64</a></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.25.0: Prefer using <code>parse_with_options</code> and using a callback</span></div></span></summary><div class="docblock"><p>Get the duration in microseconds that parsing is allowed to take.</p>
<p>This is set via <a href="struct.Parser.html#method.set_timeout_micros" title="method tree_sitter::Parser::set_timeout_micros"><code>set_timeout_micros</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_timeout_micros" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1328-1330">source</a><h4 class="code-header">pub fn <a href="#method.set_timeout_micros" class="fn">set_timeout_micros</a>(&amp;mut self, timeout_micros: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u64.html">u64</a>)</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.25.0: Prefer using <code>parse_with_options</code> and using a callback</span></div></span></summary><div class="docblock"><p>Set the maximum duration in microseconds that parsing should be allowed
to take before halting.</p>
<p>If parsing takes longer than this, it will halt early, returning <code>None</code>.
See <a href="struct.Parser.html#method.parse" title="method tree_sitter::Parser::parse"><code>parse</code></a> for more information.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_included_ranges" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1350-1372">source</a><h4 class="code-header">pub fn <a href="#method.set_included_ranges" class="fn">set_included_ranges</a>(
&amp;mut self,
ranges: &amp;[<a class="struct" href="struct.Range.html" title="struct tree_sitter::Range">Range</a>]
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.unit.html">()</a>, <a class="struct" href="struct.IncludedRangesError.html" title="struct tree_sitter::IncludedRangesError">IncludedRangesError</a>&gt;</h4></section></summary><div class="docblock"><p>Set the ranges of text that the parser should include when parsing.</p>
<p>By default, the parser will always include entire documents. This
function allows you to parse only a <em>portion</em> of a document but
still return a syntax tree whose ranges match up with the document
as a whole. You can also pass multiple disjoint ranges.</p>
<p>If <code>ranges</code> is empty, then the entire document will be parsed.
Otherwise, the given ranges must be ordered from earliest to latest
in the document, and they must not overlap. That is, the following
must hold for all <code>i</code> &lt; <code>length - 1</code>:</p>
<div class="example-wrap"><pre class="language-text"><code> ranges[i].end_byte &lt;= ranges[i + 1].start_byte
</code></pre></div>
<p>If this requirement is not satisfied, method will return
<a href="struct.IncludedRangesError.html" title="struct tree_sitter::IncludedRangesError"><code>IncludedRangesError</code></a> error with an offset in the passed ranges
slice pointing to a first incorrect range.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.included_ranges" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1377-1386">source</a><h4 class="code-header">pub fn <a href="#method.included_ranges" class="fn">included_ranges</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.Range.html" title="struct tree_sitter::Range">Range</a>&gt;</h4></section></summary><div class="docblock"><p>Get the ranges of text that the parser will include when parsing.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.cancellation_flag" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1399-1403">source</a><h4 class="code-header">pub unsafe fn <a href="#method.cancellation_flag" class="fn">cancellation_flag</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/struct.AtomicUsize.html" title="struct core::sync::atomic::AtomicUsize">AtomicUsize</a>&gt;</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.25.0: Prefer using <code>parse_with_options</code> and using a callback</span></div></span></summary><div class="docblock"><p>Get the parsers current cancellation flag pointer.</p>
<h5 id="safety-2"><a href="#safety-2">Safety</a></h5>
<p>It uses FFI</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_cancellation_flag" class="method"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1420-1429">source</a><h4 class="code-header">pub unsafe fn <a href="#method.set_cancellation_flag" class="fn">set_cancellation_flag</a>(&amp;mut self, flag: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/struct.AtomicUsize.html" title="struct core::sync::atomic::AtomicUsize">AtomicUsize</a>&gt;)</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.25.0: Prefer using <code>parse_with_options</code> and using a callback</span></div></span></summary><div class="docblock"><p>Set the parsers current cancellation flag pointer.</p>
<p>If a pointer is assigned, then the parser will periodically read from
this pointer during parsing. If it reads a non-zero value, it will halt
early, returning <code>None</code>. See <a href="struct.Parser.html#method.parse" title="method tree_sitter::Parser::parse"><code>parse</code></a> for more
information.</p>
<h5 id="safety-3"><a href="#safety-3">Safety</a></h5>
<p>It uses FFI</p>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-Parser" class="impl"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#640-644">source</a><a href="#impl-Default-for-Parser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.Parser.html" title="struct tree_sitter::Parser">Parser</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#641-643">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Drop-for-Parser" class="impl"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1432-1442">source</a><a href="#impl-Drop-for-Parser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="struct.Parser.html" title="struct tree_sitter::Parser">Parser</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#1433-1441">source</a><a href="#method.drop" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/drop/trait.Drop.html#tymethod.drop" class="fn">drop</a>(&amp;mut self)</h4></section></summary><div class='docblock'>Executes the destructor for this type. <a href="https://doc.rust-lang.org/1.76.0/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></div></details></div></details><section id="impl-Send-for-Parser" class="impl"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#3924">source</a><a href="#impl-Send-for-Parser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Parser.html" title="struct tree_sitter::Parser">Parser</a></h3></section><section id="impl-Sync-for-Parser" class="impl"><a class="src rightside" href="../src/tree_sitter/lib.rs.html#3925">source</a><a href="#impl-Sync-for-Parser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Parser.html" title="struct tree_sitter::Parser">Parser</a></h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Parser" class="impl"><a href="#impl-RefUnwindSafe-for-Parser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Parser.html" title="struct tree_sitter::Parser">Parser</a></h3></section><section id="impl-Unpin-for-Parser" class="impl"><a href="#impl-Unpin-for-Parser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Parser.html" title="struct tree_sitter::Parser">Parser</a></h3></section><section id="impl-UnwindSafe-for-Parser" class="impl"><a href="#impl-UnwindSafe-for-Parser" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Parser.html" title="struct tree_sitter::Parser">Parser</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#763">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#766">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#747-749">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#756">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#803-805">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#810">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#788-790">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#795">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>