index.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="generator" content="rustdoc">
  7. <meta name="description" content="API documentation for the Rust `failure` crate.">
  8. <meta name="keywords" content="rust, rustlang, rust-lang, failure">
  9. <title>failure - Rust</title>
  10. <link rel="stylesheet" type="text/css" href="../normalize.css">
  11. <link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle">
  12. <link rel="stylesheet" type="text/css" href="../dark.css">
  13. <link rel="stylesheet" type="text/css" href="../main.css" id="themeStyle">
  14. <script src="../storage.js"></script>
  15. </head>
  16. <body class="rustdoc mod">
  17. <!--[if lte IE 8]>
  18. <div class="warning">
  19. This old browser is unsupported and will most likely display funky
  20. things.
  21. </div>
  22. <![endif]-->
  23. <nav class="sidebar">
  24. <div class="sidebar-menu">&#9776;</div>
  25. <p class='location'>Crate failure</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'failure', ty: 'mod', relpath: '../'};</script></div>
  26. </nav>
  27. <div class="theme-picker">
  28. <button id="theme-picker" aria-label="Pick another theme!">
  29. <img src="../brush.svg" width="18" alt="Pick another theme!">
  30. </button>
  31. <div id="theme-choices"></div>
  32. </div>
  33. <script src="../theme.js"></script>
  34. <nav class="sub">
  35. <form class="search-form js-only">
  36. <div class="search-container">
  37. <input class="search-input" name="search"
  38. autocomplete="off"
  39. placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
  40. type="search">
  41. </div>
  42. </form>
  43. </nav>
  44. <section id='main' class="content">
  45. <h1 class='fqn'><span class='in-band'>Crate <a class="mod" href=''>failure</a></span><span class='out-of-band'><span id='render-detail'>
  46. <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
  47. [<span class='inner'>&#x2212;</span>]
  48. </a>
  49. </span><a class='srclink' href='../src/failure/lib.rs.html#1-229' title='goto source code'>[src]</a></span></h1>
  50. <div class='docblock'><p>An experimental new error-handling library.</p>
  51. <p>The primary items exported by this library are:</p>
  52. <ul>
  53. <li><code>Fail</code>: a new trait for custom error types in Rust.</li>
  54. <li><code>Error</code>: a wrapper around <code>Fail</code> types to make it easy to coalesce them
  55. at higher levels.</li>
  56. </ul>
  57. <p>As a general rule, library authors should create their own error types and
  58. implement <code>Fail</code> for them, whereas application authors should primarily
  59. deal with the <code>Error</code> type. There are exceptions to this rule, though, in
  60. both directions, and users should do whatever seems most appropriate to
  61. their situation.</p>
  62. </div><h2 id='macros' class='section-header'><a href="#macros">Macros</a></h2>
  63. <table>
  64. <tr class=' module-item'>
  65. <td><a class="macro" href="macro.bail.html"
  66. title='macro failure::bail'>bail</a></td>
  67. <td class='docblock-short'>
  68. <p>Exits a function early with an <code>Error</code>.</p>
  69. </td>
  70. </tr>
  71. <tr class=' module-item'>
  72. <td><a class="macro" href="macro.ensure.html"
  73. title='macro failure::ensure'>ensure</a></td>
  74. <td class='docblock-short'>
  75. <p>Exits a function early with an <code>Error</code> if the condition is not satisfied.</p>
  76. </td>
  77. </tr>
  78. <tr class=' module-item'>
  79. <td><a class="macro" href="macro.format_err.html"
  80. title='macro failure::format_err'>format_err</a></td>
  81. <td class='docblock-short'>
  82. <p>Constructs an <code>Error</code> using the standard string interpolation syntax.</p>
  83. </td>
  84. </tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
  85. <table>
  86. <tr class=' module-item'>
  87. <td><a class="struct" href="struct.Backtrace.html"
  88. title='struct failure::Backtrace'>Backtrace</a></td>
  89. <td class='docblock-short'>
  90. <p>A <code>Backtrace</code>.</p>
  91. </td>
  92. </tr>
  93. <tr class=' module-item'>
  94. <td><a class="struct" href="struct.Causes.html"
  95. title='struct failure::Causes'>Causes</a></td>
  96. <td class='docblock-short'>
  97. <p>A iterator over the causes of a <code>Fail</code></p>
  98. </td>
  99. </tr>
  100. <tr class=' module-item'>
  101. <td><a class="struct" href="struct.Compat.html"
  102. title='struct failure::Compat'>Compat</a></td>
  103. <td class='docblock-short'>
  104. <p>A compatibility wrapper around an error type from this crate.</p>
  105. </td>
  106. </tr>
  107. <tr class=' module-item'>
  108. <td><a class="struct" href="struct.Context.html"
  109. title='struct failure::Context'>Context</a></td>
  110. <td class='docblock-short'>
  111. <p>An error with context around it.</p>
  112. </td>
  113. </tr>
  114. <tr class=' module-item'>
  115. <td><a class="struct" href="struct.Error.html"
  116. title='struct failure::Error'>Error</a></td>
  117. <td class='docblock-short'>
  118. <p>The <code>Error</code> type, which can contain any failure.</p>
  119. </td>
  120. </tr>
  121. <tr class=' module-item'>
  122. <td><a class="struct" href="struct.SyncFailure.html"
  123. title='struct failure::SyncFailure'>SyncFailure</a></td>
  124. <td class='docblock-short'>
  125. <p>Wrapper for <code>std</code> errors to make them <code>Sync</code>.</p>
  126. </td>
  127. </tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
  128. <table>
  129. <tr class=' module-item'>
  130. <td><a class="trait" href="trait.Fail.html"
  131. title='trait failure::Fail'>Fail</a></td>
  132. <td class='docblock-short'>
  133. <p>The <code>Fail</code> trait.</p>
  134. </td>
  135. </tr>
  136. <tr class=' module-item'>
  137. <td><a class="trait" href="trait.ResultExt.html"
  138. title='trait failure::ResultExt'>ResultExt</a></td>
  139. <td class='docblock-short'>
  140. <p>Extension methods for <code>Result</code>.</p>
  141. </td>
  142. </tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
  143. <table>
  144. <tr class=' module-item'>
  145. <td><a class="fn" href="fn.err_msg.html"
  146. title='fn failure::err_msg'>err_msg</a></td>
  147. <td class='docblock-short'>
  148. <p>Constructs a <code>Fail</code> type from a string.</p>
  149. </td>
  150. </tr></table></section>
  151. <section id='search' class="content hidden"></section>
  152. <section class="footer"></section>
  153. <aside id="help" class="hidden">
  154. <div>
  155. <h1 class="hidden">Help</h1>
  156. <div class="shortcuts">
  157. <h2>Keyboard Shortcuts</h2>
  158. <dl>
  159. <dt><kbd>?</kbd></dt>
  160. <dd>Show this help dialog</dd>
  161. <dt><kbd>S</kbd></dt>
  162. <dd>Focus the search field</dd>
  163. <dt><kbd>↑</kbd></dt>
  164. <dd>Move up in search results</dd>
  165. <dt><kbd>↓</kbd></dt>
  166. <dd>Move down in search results</dd>
  167. <dt><kbd>↹</kbd></dt>
  168. <dd>Switch tab</dd>
  169. <dt><kbd>&#9166;</kbd></dt>
  170. <dd>Go to active search result</dd>
  171. <dt><kbd>+</kbd></dt>
  172. <dd>Expand all sections</dd>
  173. <dt><kbd>-</kbd></dt>
  174. <dd>Collapse all sections</dd>
  175. </dl>
  176. </div>
  177. <div class="infos">
  178. <h2>Search Tricks</h2>
  179. <p>
  180. Prefix searches with a type followed by a colon (e.g.
  181. <code>fn:</code>) to restrict the search to a given type.
  182. </p>
  183. <p>
  184. Accepted types are: <code>fn</code>, <code>mod</code>,
  185. <code>struct</code>, <code>enum</code>,
  186. <code>trait</code>, <code>type</code>, <code>macro</code>,
  187. and <code>const</code>.
  188. </p>
  189. <p>
  190. Search functions by type signature (e.g.
  191. <code>vec -> usize</code> or <code>* -> vec</code>)
  192. </p>
  193. </div>
  194. </div>
  195. </aside>
  196. <script>
  197. window.rootPath = "../";
  198. window.currentCrate = "failure";
  199. </script>
  200. <script src="../main.js"></script>
  201. <script defer src="../search-index.js"></script>
  202. </body>
  203. </html>