blob: 5e675ccb5a0e7bcd0f613ec870ed00f40fce2aff [file] [log] [blame]
<!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="Trait which defines a combine parse error."><meta name="keywords" content="rust, rustlang, rust-lang, ParseError"><title>ParseError in combine - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[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><a class="sidebar-logo" href="../combine/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../combine/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">ParseError</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.StreamError">StreamError</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.add">add</a></li><li><a href="#tymethod.empty">empty</a></li><li><a href="#tymethod.into_other">into_other</a></li><li><a href="#tymethod.is_unexpected_end_of_input">is_unexpected_end_of_input</a></li><li><a href="#tymethod.set_expected">set_expected</a></li><li><a href="#tymethod.set_position">set_position</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.add_expected">add_expected</a></li><li><a href="#method.add_message">add_message</a></li><li><a href="#method.add_unexpected">add_unexpected</a></li><li><a href="#method.clear_expected">clear_expected</a></li><li><a href="#method.from_error">from_error</a></li><li><a href="#method.merge">merge</a></li><li><a href="#method.position">position</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In combine</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Trait <a href="index.html">combine</a>::<wbr><a class="trait" href="#">ParseError</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/combine/error.rs.html#456-527">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub trait ParseError&lt;Item, Range, Position&gt;: Sized + PartialEq {
type <a href="#associatedtype.StreamError" class="associatedtype">StreamError</a>: <a class="trait" href="error/trait.StreamError.html" title="trait combine::error::StreamError">StreamError</a>&lt;Item, Range&gt;;
<details class="rustdoc-toggle type-contents-toggle"><summary class="hideme"><span>Show 13 methods</span></summary> fn <a href="#tymethod.empty" class="fnname">empty</a>(position: Position) -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.set_position" class="fnname">set_position</a>(&amp;mut self, position: Position);
<span class="item-spacer"></span> fn <a href="#tymethod.add" class="fnname">add</a>(&amp;mut self, err: Self::<a class="associatedtype" href="trait.ParseError.html#associatedtype.StreamError" title="type combine::ParseError::StreamError">StreamError</a>);
<span class="item-spacer"></span> fn <a href="#tymethod.set_expected" class="fnname">set_expected</a>&lt;F&gt;(self_: &amp;mut <a class="struct" href="error/struct.Tracked.html" title="struct combine::error::Tracked">Tracked</a>&lt;Self&gt;, info: Self::<a class="associatedtype" href="trait.ParseError.html#associatedtype.StreamError" title="type combine::ParseError::StreamError">StreamError</a>, f: F)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: FnOnce(&amp;mut <a class="struct" href="error/struct.Tracked.html" title="struct combine::error::Tracked">Tracked</a>&lt;Self&gt;)</span>;
<span class="item-spacer"></span> fn <a href="#tymethod.is_unexpected_end_of_input" class="fnname">is_unexpected_end_of_input</a>(&amp;self) -&gt; bool;
<span class="item-spacer"></span> fn <a href="#tymethod.into_other" class="fnname">into_other</a>&lt;T&gt;(self) -&gt; T<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="trait.ParseError.html" title="trait combine::ParseError">ParseError</a>&lt;Item, Range, Position&gt;</span>;
fn <a href="#method.from_error" class="fnname">from_error</a>(position: Position, err: Self::<a class="associatedtype" href="trait.ParseError.html#associatedtype.StreamError" title="type combine::ParseError::StreamError">StreamError</a>) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.position" class="fnname">position</a>(&amp;self) -&gt; Position { ... }
<span class="item-spacer"></span> fn <a href="#method.merge" class="fnname">merge</a>(self, other: Self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.add_expected" class="fnname">add_expected</a>&lt;E&gt;(&amp;mut self, info: E)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E: for&lt;'s&gt; <a class="trait" href="error/trait.ErrorInfo.html" title="trait combine::error::ErrorInfo">ErrorInfo</a>&lt;'s, Item, Range&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.add_unexpected" class="fnname">add_unexpected</a>&lt;E&gt;(&amp;mut self, info: E)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E: for&lt;'s&gt; <a class="trait" href="error/trait.ErrorInfo.html" title="trait combine::error::ErrorInfo">ErrorInfo</a>&lt;'s, Item, Range&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.add_message" class="fnname">add_message</a>&lt;E&gt;(&amp;mut self, info: E)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E: for&lt;'s&gt; <a class="trait" href="error/trait.ErrorInfo.html" title="trait combine::error::ErrorInfo">ErrorInfo</a>&lt;'s, Item, Range&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.clear_expected" class="fnname">clear_expected</a>(&amp;mut self) { ... }
</details>}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait which defines a combine parse error.</p>
<p>A parse error is composed of zero or more <code>StreamError</code> instances which gets added to it as
errors are encountered during parsing.</p>
</div></details><h2 id="required-associated-types" class="small-section-header">Required Associated Types<a href="#required-associated-types" class="anchor"></a></h2><div class="methods"><section id="associatedtype.StreamError" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#457">source</a><h4 class="code-header">type <a href="#associatedtype.StreamError" class="associatedtype">StreamError</a>: <a class="trait" href="error/trait.StreamError.html" title="trait combine::error::StreamError">StreamError</a>&lt;Item, Range&gt;</h4></section></div><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.empty" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#462">source</a><h4 class="code-header">fn <a href="#tymethod.empty" class="fnname">empty</a>(position: Position) -&gt; Self</h4></section></summary><div class="docblock"><p>Constructs an empty error.</p>
<p>An empty error is expected to be cheap to create as it is frequently created and discarded.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.set_position" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#477">source</a><h4 class="code-header">fn <a href="#tymethod.set_position" class="fnname">set_position</a>(&amp;mut self, position: Position)</h4></section></summary><div class="docblock"><p>Sets the position of this <code>ParseError</code></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.add" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#490">source</a><h4 class="code-header">fn <a href="#tymethod.add" class="fnname">add</a>(&amp;mut self, err: Self::<a class="associatedtype" href="trait.ParseError.html#associatedtype.StreamError" title="type combine::ParseError::StreamError">StreamError</a>)</h4></section></summary><div class="docblock"><p>Adds a <code>StreamError</code> to <code>self</code>.</p>
<p>It is up to each individual error type to define what adding an error does, some may push
it to a vector while others may only keep <code>self</code> or <code>err</code> to avoid allocation</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.set_expected" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#514-516">source</a><h4 class="code-header">fn <a href="#tymethod.set_expected" class="fnname">set_expected</a>&lt;F&gt;(self_: &amp;mut <a class="struct" href="error/struct.Tracked.html" title="struct combine::error::Tracked">Tracked</a>&lt;Self&gt;, info: Self::<a class="associatedtype" href="trait.ParseError.html#associatedtype.StreamError" title="type combine::ParseError::StreamError">StreamError</a>, f: F)<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnOnce(&amp;mut <a class="struct" href="error/struct.Tracked.html" title="struct combine::error::Tracked">Tracked</a>&lt;Self&gt;),</span></h4></section></summary><div class="docblock"><p>Sets <code>info</code> as the <em>only</em> <code>Expected</code> error of <code>self</code></p>
</div></details><section id="tymethod.is_unexpected_end_of_input" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#521">source</a><h4 class="code-header">fn <a href="#tymethod.is_unexpected_end_of_input" class="fnname">is_unexpected_end_of_input</a>(&amp;self) -&gt; bool</h4></section><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.into_other" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#524-526">source</a><h4 class="code-header">fn <a href="#tymethod.into_other" class="fnname">into_other</a>&lt;T&gt;(self) -&gt; T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="trait.ParseError.html" title="trait combine::ParseError">ParseError</a>&lt;Item, Range, Position&gt;,</span></h4></section></summary><div class="docblock"><p>Does a best-effort conversion of <code>self</code> into another <code>ParseError</code></p>
</div></details></div><h2 id="provided-methods" class="small-section-header">Provided Methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_error" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#465-469">source</a><h4 class="code-header">fn <a href="#method.from_error" class="fnname">from_error</a>(position: Position, err: Self::<a class="associatedtype" href="trait.ParseError.html#associatedtype.StreamError" title="type combine::ParseError::StreamError">StreamError</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Creates a <code>ParseError</code> from a single <code>Self::StreamError</code></p>
</div></details><section id="method.position" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#471-474">source</a><h4 class="code-header">fn <a href="#method.position" class="fnname">position</a>(&amp;self) -&gt; Position</h4></section><details class="rustdoc-toggle method-toggle" open><summary><section id="method.merge" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#482-484">source</a><h4 class="code-header">fn <a href="#method.merge" class="fnname">merge</a>(self, other: Self) -&gt; Self</h4></section></summary><div class="docblock"><p>Merges two errors. If they exist at the same position the errors of <code>other</code> are
added to <code>self</code> (using the semantics of <code>add</code>). If they are not at the same
position the error furthest ahead are returned, ignoring the other <code>ParseError</code>.</p>
</div></details><section id="method.add_expected" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#492-497">source</a><h4 class="code-header">fn <a href="#method.add_expected" class="fnname">add_expected</a>&lt;E&gt;(&amp;mut self, info: E)<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;E: for&lt;'s&gt; <a class="trait" href="error/trait.ErrorInfo.html" title="trait combine::error::ErrorInfo">ErrorInfo</a>&lt;'s, Item, Range&gt;,</span></h4></section><section id="method.add_unexpected" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#499-504">source</a><h4 class="code-header">fn <a href="#method.add_unexpected" class="fnname">add_unexpected</a>&lt;E&gt;(&amp;mut self, info: E)<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;E: for&lt;'s&gt; <a class="trait" href="error/trait.ErrorInfo.html" title="trait combine::error::ErrorInfo">ErrorInfo</a>&lt;'s, Item, Range&gt;,</span></h4></section><section id="method.add_message" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#506-511">source</a><h4 class="code-header">fn <a href="#method.add_message" class="fnname">add_message</a>&lt;E&gt;(&amp;mut self, info: E)<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;E: for&lt;'s&gt; <a class="trait" href="error/trait.ErrorInfo.html" title="trait combine::error::ErrorInfo">ErrorInfo</a>&lt;'s, Item, Range&gt;,</span></h4></section><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clear_expected" class="method has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#519">source</a><h4 class="code-header">fn <a href="#method.clear_expected" class="fnname">clear_expected</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Removes any expected errors currently in <code>self</code></p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ParseError%3CItem%2C%20Range%2C%20Position%3E-for-StringStreamError" class="impl has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#842-891">source</a><a href="#impl-ParseError%3CItem%2C%20Range%2C%20Position%3E-for-StringStreamError" class="anchor"></a><h3 class="code-header">impl&lt;Item, Range, Position&gt; <a class="trait" href="trait.ParseError.html" title="trait combine::ParseError">ParseError</a>&lt;Item, Range, Position&gt; for <a class="enum" href="error/enum.StringStreamError.html" title="enum combine::error::StringStreamError">StringStreamError</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Position: Default,</span></h3></section></summary><div class="impl-items"><section id="associatedtype.StreamError-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.StreamError-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.StreamError" class="associatedtype">StreamError</a> = <a class="enum" href="error/enum.StringStreamError.html" title="enum combine::error::StringStreamError">StringStreamError</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ParseError%3CItem%2C%20Range%2C%20Position%3E-for-UnexpectedParse" class="impl has-srclink"><a class="srclink rightside" href="../src/combine/error.rs.html#653-703">source</a><a href="#impl-ParseError%3CItem%2C%20Range%2C%20Position%3E-for-UnexpectedParse" class="anchor"></a><h3 class="code-header">impl&lt;Item, Range, Position&gt; <a class="trait" href="trait.ParseError.html" title="trait combine::ParseError">ParseError</a>&lt;Item, Range, Position&gt; for <a class="enum" href="error/enum.UnexpectedParse.html" title="enum combine::error::UnexpectedParse">UnexpectedParse</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Position: Default,</span></h3></section></summary><div class="impl-items"><section id="associatedtype.StreamError-2" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.StreamError-2" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.StreamError" class="associatedtype">StreamError</a> = <a class="enum" href="error/enum.UnexpectedParse.html" title="enum combine::error::UnexpectedParse">UnexpectedParse</a></h4></section></div></details></div><script src="../implementors/combine/error/trait.ParseError.js" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="combine" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>