Skip to content

Commit

Permalink
Refactor rustdoc to use dynamic crate version
Browse files Browse the repository at this point in the history
  • Loading branch information
joelparkerhenderson committed Oct 4, 2024
1 parent 07472a3 commit b2c3162
Show file tree
Hide file tree
Showing 681 changed files with 9,786 additions and 5,316 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
Cargo.lock
tmp
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Changes highlights for recent major versions.

* Add Poll macros: `assert_ready`, `assert_pending`, etc.

* Add length macros: `assert_len_eq`, `assert_len_ne`, etc.
* Add length macros: `assert_len`, `assert_is_empty`, etc.

* Add read macros: `assert_fs_read_to_string_*`, `assert_io_read_to_string_*`, etc.
* Add read macros: `assert_fs_read_to_string`, `assert_io_read_to_string`, etc.

* Add approx macros: `assert_approx_eq`, `assert_approx_ne`.

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "assertables"
version = "8.13.0"
version = "8.14.0"
authors = ["Joel Parker Henderson <[email protected]>"]
edition = "2021"
description = "Assertables: assert macros for better testing, debugging, quality assurance, and runtime reliability."
Expand Down
157 changes: 97 additions & 60 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions book.md
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ macro_rules! assert_gt_as_result {
" left: `{:?}`,\n",
" right: `{:?}`"
),
env!("CARGO_PKG_VERSION")
stringify!($a), $a,
stringify!($b), $b,
a,
Expand Down
2 changes: 1 addition & 1 deletion doc/lib/all.html

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions doc/lib/assert_approx/assert_approx_eq/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!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="Assert a number is approximately equal to another number."><title>lib::assert_approx::assert_approx_eq - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-c5d6553a23f1e5a6.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.81.0 (eeb90cda1 2024-09-04)" data-channel="1.81.0" data-search-js="search-d234aafac6c221dd.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-d2fab2bf619172d3.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-df360f571f6edeae.css"></noscript><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 mod"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../lib/index.html">lib</a></h2></div><h2 class="location"><a href="#">Module assert_approx_eq</a></h2><div class="sidebar-elems"><h2><a href="../index.html">In lib::assert_approx</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../../index.html">lib</a>::<wbr><a href="../index.html">assert_approx</a>::<wbr><a class="mod" href="#">assert_approx_eq</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../../src/lib/assert_approx/assert_approx_eq.rs.html#1-288">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Assert a number is approximately equal to another number.</p>
<p>Pseudocode:<br>
| a - b | ≤ 1e-6</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>assertables::<span class="kw-2">*</span>;
<span class="kw">let </span>a: f32 = <span class="number">1.0000001</span>;
<span class="kw">let </span>b: f32 = <span class="number">1.0000011</span>;
<span class="macro">assert_approx_eq!</span>(a, b);</code></pre></div>
<h3 id="comparisons"><a class="doc-anchor" href="#comparisons">§</a>Comparisons</h3>
<p>This crate provides macro groups that test approximations and nearness:</p>
<ul>
<li>
<p><a href="../../macro.assert_approx_eq.html" title="macro lib::assert_approx_eq"><code>assert_approx_eq</code></a> and
<a href="../../macro.assert_approx_ne.html" title="macro lib::assert_approx_ne"><code>assert_approx_ne</code></a> test the approximate
equality within 1e-6. The macro name and the approximate value are chosen
to be similar to the longtime popular rust crate <code>assert_approx_eq</code>.</p>
</li>
<li>
<p><a href="../../macro.assert_in_delta.html" title="macro lib::assert_in_delta"><code>assert_in_delta</code></a> tests the absolute error
(i.e. delta). This is the magnitude of the difference between the exact
value and the approximation.</p>
</li>
<li>
<p><a href="../../macro.assert_in_epsilon.html" title="macro lib::assert_in_epsilon"><code>assert_in_epsilon</code></a> tests the relative
error (i.e. epsilon). This is the absolute error divided by the magnitude
of the exact value. This can be used to compare approximations of numbers
of wildly differing size.</p>
</li>
</ul>
<p>Examples:</p>
<ul>
<li>
<p>Approximating the number 100 and 103 has an absolute error (delta) of 3
and a relative error (epsilon) of 0.03.</p>
</li>
<li>
<p>Approximating the number 1,000,000 and 1,000,003 has an absolute error
(delta) of 3, and a relative error (espilon) of 0.000003.</p>
</li>
<li>
<p>For many kinds of applications, the relative error is more important than
the absolute error.</p>
</li>
</ul>
<h3 id="thanks"><a class="doc-anchor" href="#thanks">§</a>Thanks</h3>
<ul>
<li>
<p>Thanks to <a href="https://github.com/ashleygwilliams">Ashley Williams</a> for
creating and maintaining the <code>assert_approx_eq</code> crate.</p>
</li>
<li>
<p>Thanks to <a href="https://github.com/zenspider">Ryan Davis</a> and Ruby minitest for
creating and maintaining <code>assert_in_delta</code> and <code>assert_in_epsilon</code> code.</p>
</li>
</ul>
<h2 id="module-macros"><a class="doc-anchor" href="#module-macros">§</a>Module macros</h2>
<ul>
<li><a href="../../macro.assert_approx_eq.html" title="macro lib::assert_approx_eq"><code>assert_approx_eq</code></a></li>
<li><a href="../../macro.assert_approx_eq_as_result.html" title="macro lib::assert_approx_eq_as_result"><code>assert_approx_eq_as_result</code></a></li>
<li><a href="../../macro.debug_assert_approx_eq.html" title="macro lib::debug_assert_approx_eq"><code>debug_assert_approx_eq</code></a></li>
</ul>
</div></details></section></div></main></body></html>
1 change: 1 addition & 0 deletions doc/lib/assert_approx/assert_approx_eq/sidebar-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {};
62 changes: 62 additions & 0 deletions doc/lib/assert_approx/assert_approx_ne/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!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="Assert a number is approximately not equal to another number."><title>lib::assert_approx::assert_approx_ne - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-c5d6553a23f1e5a6.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.81.0 (eeb90cda1 2024-09-04)" data-channel="1.81.0" data-search-js="search-d234aafac6c221dd.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-d2fab2bf619172d3.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-df360f571f6edeae.css"></noscript><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 mod"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../lib/index.html">lib</a></h2></div><h2 class="location"><a href="#">Module assert_approx_ne</a></h2><div class="sidebar-elems"><h2><a href="../index.html">In lib::assert_approx</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../../index.html">lib</a>::<wbr><a href="../index.html">assert_approx</a>::<wbr><a class="mod" href="#">assert_approx_ne</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../../src/lib/assert_approx/assert_approx_ne.rs.html#1-288">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Assert a number is approximately not equal to another number.</p>
<p>Pseudocode:<br>
| a - b | &gt; 1e-6</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>assertables::<span class="kw-2">*</span>;
<span class="kw">let </span>a: f32 = <span class="number">1.0000001</span>;
<span class="kw">let </span>b: f32 = <span class="number">1.0000012</span>;
<span class="macro">assert_approx_ne!</span>(a, b);</code></pre></div>
<h3 id="comparisons"><a class="doc-anchor" href="#comparisons">§</a>Comparisons</h3>
<p>This crate provides macro groups that test approximations and nearness:</p>
<ul>
<li>
<p><a href="../../macro.assert_approx_eq.html" title="macro lib::assert_approx_eq"><code>assert_approx_eq</code></a> and
<a href="../../macro.assert_approx_ne.html" title="macro lib::assert_approx_ne"><code>assert_approx_ne</code></a> test the approximate
equality within 1e-6. The macro name and the approximate value are chosen
to be similar to the longtime popular rust crate <code>assert_approx_eq</code>.</p>
</li>
<li>
<p><a href="../../macro.assert_in_delta.html" title="macro lib::assert_in_delta"><code>assert_in_delta</code></a> tests the absolute error
(i.e. delta). This is the magnitude of the difference between the exact
value and the approximation.</p>
</li>
<li>
<p><a href="../../macro.assert_in_epsilon.html" title="macro lib::assert_in_epsilon"><code>assert_in_epsilon</code></a> tests the relative
error (i.e. epsilon). This is the absolute error divided by the magnitude
of the exact value. This can be used to compare approximations of numbers
of wildly differing size.</p>
</li>
</ul>
<p>Examples:</p>
<ul>
<li>
<p>Approximating the number 100 and 103 has an absolute error (delta) of 3
and a relative error (epsilon) of 0.03.</p>
</li>
<li>
<p>Approximating the number 1,000,000 and 1,000,003 has an absolute error
(delta) of 3, and a relative error (espilon) of 0.000003.</p>
</li>
<li>
<p>For many kinds of applications, the relative error is more important than
the absolute error.</p>
</li>
</ul>
<h3 id="thanks"><a class="doc-anchor" href="#thanks">§</a>Thanks</h3>
<ul>
<li>
<p>Thanks to <a href="https://github.com/ashleygwilliams">Ashley Williams</a> for
creating and maintaining the <code>assert_approx_eq</code> crate.</p>
</li>
<li>
<p>Thanks to <a href="https://github.com/zenspider">Ryan Davis</a> and Ruby minitest for
creating and maintaining <code>assert_in_delta</code> and <code>assert_in_epsilon</code> code.</p>
</li>
</ul>
<h2 id="module-macros"><a class="doc-anchor" href="#module-macros">§</a>Module macros</h2>
<ul>
<li><a href="../../macro.assert_approx_ne.html" title="macro lib::assert_approx_ne"><code>assert_approx_ne</code></a></li>
<li><a href="../../macro.assert_approx_ne_as_result.html" title="macro lib::assert_approx_ne_as_result"><code>assert_approx_ne_as_result</code></a></li>
<li><a href="../../macro.debug_assert_approx_ne.html" title="macro lib::debug_assert_approx_ne"><code>debug_assert_approx_ne</code></a></li>
</ul>
</div></details></section></div></main></body></html>
1 change: 1 addition & 0 deletions doc/lib/assert_approx/assert_approx_ne/sidebar-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {};
1 change: 1 addition & 0 deletions doc/lib/assert_approx/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!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="API documentation for the Rust `assert_approx` mod in crate `lib`."><title>lib::assert_approx - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-c5d6553a23f1e5a6.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.81.0 (eeb90cda1 2024-09-04)" data-channel="1.81.0" data-search-js="search-d234aafac6c221dd.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-d2fab2bf619172d3.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-df360f571f6edeae.css"></noscript><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 mod"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../lib/index.html">lib</a></h2></div><h2 class="location"><a href="#">Module assert_approx</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#modules">Modules</a></li></ul></section><h2><a href="../index.html">In crate lib</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">lib</a>::<wbr><a class="mod" href="#">assert_approx</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/lib/assert_approx/mod.rs.html#1-2">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="assert_approx_eq/index.html" title="mod lib::assert_approx::assert_approx_eq">assert_approx_eq</a></div><div class="desc docblock-short">Assert a number is approximately equal to another number.</div></li><li><div class="item-name"><a class="mod" href="assert_approx_ne/index.html" title="mod lib::assert_approx::assert_approx_ne">assert_approx_ne</a></div><div class="desc docblock-short">Assert a number is approximately not equal to another number.</div></li></ul></section></div></main></body></html>
1 change: 1 addition & 0 deletions doc/lib/assert_approx/sidebar-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"mod":["assert_approx_eq","assert_approx_ne"]};
Loading

0 comments on commit b2c3162

Please sign in to comment.