doc update

generated from commit e0c2eadae0
This commit is contained in:
Harald Hoyer 2018-12-20 15:12:59 +01:00
parent cb1bf6dd17
commit 991a7a0786
7 changed files with 24 additions and 6 deletions

View file

@ -140,7 +140,11 @@
<div id="content" class="content"> <div id="content" class="content">
<main> <main>
<pre><pre class="playpen"><code class="language-rust">use std::error::Error; <a class="header" href="#simple-string-errors" id="simple-string-errors"><h1>Simple String Errors</h1></a>
<p>The most simplest of doing error handling in rust is by returning <code>String</code> as a <code>Box&lt;Error&gt;</code>.</p>
<p>As you can see by running the example, this only prints out the last <code>Error</code>.</p>
<p>If the rust <code>main</code> function returns an Err(), this Err() will be displayed with <code>std::fmt::Debug</code>.</p>
<pre><pre class="playpen"><code class="language-rust">use std::error::Error;
use std::result::Result; use std::result::Result;
fn do_some_io() -&gt; Result&lt;(), Box&lt;Error&gt;&gt; { fn do_some_io() -&gt; Result&lt;(), Box&lt;Error&gt;&gt; {

View file

@ -140,7 +140,11 @@
<div id="content" class="content"> <div id="content" class="content">
<main> <main>
<pre><pre class="playpen"><code class="language-rust">use std::error::Error; <a class="header" href="#simple-string-errors" id="simple-string-errors"><h1>Simple String Errors</h1></a>
<p>The most simplest of doing error handling in rust is by returning <code>String</code> as a <code>Box&lt;Error&gt;</code>.</p>
<p>As you can see by running the example, this only prints out the last <code>Error</code>.</p>
<p>If the rust <code>main</code> function returns an Err(), this Err() will be displayed with <code>std::fmt::Debug</code>.</p>
<pre><pre class="playpen"><code class="language-rust">use std::error::Error;
use std::result::Result; use std::result::Result;
fn do_some_io() -&gt; Result&lt;(), Box&lt;Error&gt;&gt; { fn do_some_io() -&gt; Result&lt;(), Box&lt;Error&gt;&gt; {
@ -166,6 +170,9 @@ fn main() -&gt; Result&lt;(), Box&lt;Error&gt;&gt; {
func1() func1()
} }
</code></pre></pre> </code></pre></pre>
<a class="header" href="#simple-chained-string-errors" id="simple-chained-string-errors"><h1>Simple Chained String Errors</h1></a>
<p>Now with the help of the <code>chainerror</code> crate, we can have a nicer output.</p>
<p>Press the play button in the upper right corner and see the nice debug output.</p>
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*; <pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
use std::error::Error; use std::error::Error;
use std::result::Result; use std::result::Result;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -140,7 +140,11 @@
<div id="content" class="content"> <div id="content" class="content">
<main> <main>
<pre><pre class="playpen"><code class="language-rust">use std::error::Error; <a class="header" href="#simple-string-errors" id="simple-string-errors"><h1>Simple String Errors</h1></a>
<p>The most simplest of doing error handling in rust is by returning <code>String</code> as a <code>Box&lt;Error&gt;</code>.</p>
<p>As you can see by running the example, this only prints out the last <code>Error</code>.</p>
<p>If the rust <code>main</code> function returns an Err(), this Err() will be displayed with <code>std::fmt::Debug</code>.</p>
<pre><pre class="playpen"><code class="language-rust">use std::error::Error;
use std::result::Result; use std::result::Result;
fn do_some_io() -&gt; Result&lt;(), Box&lt;Error&gt;&gt; { fn do_some_io() -&gt; Result&lt;(), Box&lt;Error&gt;&gt; {

View file

@ -140,7 +140,10 @@
<div id="content" class="content"> <div id="content" class="content">
<main> <main>
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*; <a class="header" href="#simple-chained-string-errors" id="simple-chained-string-errors"><h1>Simple Chained String Errors</h1></a>
<p>Now with the help of the <code>chainerror</code> crate, we can have a nicer output.</p>
<p>Press the play button in the upper right corner and see the nice debug output.</p>
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
use std::error::Error; use std::error::Error;
use std::result::Result; use std::result::Result;