Skip to content

Commit

Permalink
Deploying to gh-pages from @ 4e30e5f 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinleroy committed Jan 2, 2025
1 parent df714dc commit 41b449f
Show file tree
Hide file tree
Showing 10 changed files with 1,290 additions and 721 deletions.
2 changes: 0 additions & 2 deletions css/chrome.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* CSS for UI elements (a.k.a. chrome) */

@import 'variables.css';

html {
scrollbar-color: var(--scrollbar) var(--bg);
}
Expand Down
2 changes: 0 additions & 2 deletions css/general.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Base styles and content styles */

@import 'variables.css';

:root {
/* Browser default font-size is 16px, this way 1 rem = 10px */
font-size: 62.5%;
Expand Down
1 change: 1 addition & 0 deletions highlight.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ <h2 id="your-first-web-server"><a class="header" href="#your-first-web-server">Y
<h2 id="down-the-search-tree"><a class="header" href="#down-the-search-tree">Down the Search Tree</a></h2>
<p>In Rust we write type definitions and trait implementations separately—we refer to trait implementations as “impl blocks.” The inner compiler component called the <em>trait solver</em> is responsible for answering queries like “Does <code>{login}</code> implement <code>Handler</code>?” such queries appear as trait bounds in the source code. The trait solver searches through the impl blocks trying to find whether or not the trait bound holds.</p>
<p>In this post we will be using the <em>search tree</em> a data structure produced by the trait solver that describes how it searched impl blocks, and why—or why not—a particular trait bound holds.</p>
<p>Here’s an illustrative diagram of the Axum-error search tree. Argus provides the search tree in a different format, similar to a directory tree, as you shall see further on.</p>
<p>Here’s an illustrative diagram of the Axum-error search tree. Argus provides the search tree in a different format, similar to a directory tree, as you will see further on.</p>
<pre class="mermaid">---
title: Search tree produced by the Axum trait error
---
Expand Down Expand Up @@ -282,7 +282,7 @@ <h2 id="down-the-search-tree"><a class="header" href="#down-the-search-tree">Dow
Fut = Future&lt;Output = Res&gt;
Res = bool
</code></pre>
<p>and add the where-clause constraints as children of the impl block. Notice the constraint <code>Res: IntoResponse</code>, given that <code>Res = bool</code>, the constraint requires that booleans implement <code>IntoResponse</code>, but they don’t. This is one of the root causes of the error and we shal look at how to fix the problem in the following section. But before we jump back to the code and start fixing issues, let’s reflect on the Argus interface and see how we can reach the same conclusion faster.</p>
<p>and add the where-clause constraints as children of the impl block. Notice the constraint <code>Res: IntoResponse</code>, given that <code>Res = bool</code>, the constraint requires that booleans implement <code>IntoResponse</code>, but they don’t. This is one of the root causes of the error and we will look at how to fix the problem in the following section. But before we jump back to the code and start fixing issues, let’s reflect on the Argus interface and see how we can reach the same conclusion faster.</p>
<p style="text-align:center"><img src="assets/axum-hello-server/top-down-error-highlighted.png" alt="Search tree found impl" width="600"></p>
<p>The screenshots included so far of the trait search tree are from the Top-Down view in Argus. This means we view the search just as Rust performed it: We started at the root question <code>{login}: Handler&lt;_, _&gt;</code>, descended into the impl blocks, and found the failing where-clause in a tree leaf—highlighted in red. There’s a second failing bound, but we’ll come back to that in the next section. The insight is that errors are <em>leaves</em> in the search tree, so the Top-Down view doesn’t prioritize showing you errors, but rather the full trait solving process.</p>
<h2 id="up-the-search-tree"><a class="header" href="#up-the-search-tree">Up the Search Tree</a></h2>
Expand Down
36 changes: 35 additions & 1 deletion mermaid-init.js
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
mermaid.initialize({startOnLoad:true});
(() => {
const darkThemes = ['ayu', 'navy', 'coal'];
const lightThemes = ['light', 'rust'];

const classList = document.getElementsByTagName('html')[0].classList;

let lastThemeWasLight = true;
for (const cssClass of classList) {
if (darkThemes.includes(cssClass)) {
lastThemeWasLight = false;
break;
}
}

const theme = lastThemeWasLight ? 'default' : 'dark';
mermaid.initialize({ startOnLoad: true, theme });

// Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page

for (const darkTheme of darkThemes) {
document.getElementById(darkTheme).addEventListener('click', () => {
if (lastThemeWasLight) {
window.location.reload();
}
});
}

for (const lightTheme of lightThemes) {
document.getElementById(lightTheme).addEventListener('click', () => {
if (!lastThemeWasLight) {
window.location.reload();
}
});
}
})();
1,954 changes: 1,246 additions & 708 deletions mermaid.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ <h2 id="your-first-web-server"><a class="header" href="#your-first-web-server">Y
<h2 id="down-the-search-tree"><a class="header" href="#down-the-search-tree">Down the Search Tree</a></h2>
<p>In Rust we write type definitions and trait implementations separately—we refer to trait implementations as “impl blocks.” The inner compiler component called the <em>trait solver</em> is responsible for answering queries like “Does <code>{login}</code> implement <code>Handler</code>?” such queries appear as trait bounds in the source code. The trait solver searches through the impl blocks trying to find whether or not the trait bound holds.</p>
<p>In this post we will be using the <em>search tree</em> a data structure produced by the trait solver that describes how it searched impl blocks, and why—or why not—a particular trait bound holds.</p>
<p>Here’s an illustrative diagram of the Axum-error search tree. Argus provides the search tree in a different format, similar to a directory tree, as you shall see further on.</p>
<p>Here’s an illustrative diagram of the Axum-error search tree. Argus provides the search tree in a different format, similar to a directory tree, as you will see further on.</p>
<pre class="mermaid">---
title: Search tree produced by the Axum trait error
---
Expand Down Expand Up @@ -283,7 +283,7 @@ <h2 id="down-the-search-tree"><a class="header" href="#down-the-search-tree">Dow
Fut = Future&lt;Output = Res&gt;
Res = bool
</code></pre>
<p>and add the where-clause constraints as children of the impl block. Notice the constraint <code>Res: IntoResponse</code>, given that <code>Res = bool</code>, the constraint requires that booleans implement <code>IntoResponse</code>, but they don’t. This is one of the root causes of the error and we shal look at how to fix the problem in the following section. But before we jump back to the code and start fixing issues, let’s reflect on the Argus interface and see how we can reach the same conclusion faster.</p>
<p>and add the where-clause constraints as children of the impl block. Notice the constraint <code>Res: IntoResponse</code>, given that <code>Res = bool</code>, the constraint requires that booleans implement <code>IntoResponse</code>, but they don’t. This is one of the root causes of the error and we will look at how to fix the problem in the following section. But before we jump back to the code and start fixing issues, let’s reflect on the Argus interface and see how we can reach the same conclusion faster.</p>
<p style="text-align:center"><img src="assets/axum-hello-server/top-down-error-highlighted.png" alt="Search tree found impl" width="600"></p>
<p>The screenshots included so far of the trait search tree are from the Top-Down view in Argus. This means we view the search just as Rust performed it: We started at the root question <code>{login}: Handler&lt;_, _&gt;</code>, descended into the impl blocks, and found the failing where-clause in a tree leaf—highlighted in red. There’s a second failing bound, but we’ll come back to that in the next section. The insight is that errors are <em>leaves</em> in the search tree, so the Top-Down view doesn’t prioritize showing you errors, but rather the full trait solving process.</p>
<h2 id="up-the-search-tree"><a class="header" href="#up-the-search-tree">Up the Search Tree</a></h2>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions trait-debugging-101.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ <h2 id="your-first-web-server"><a class="header" href="#your-first-web-server">Y
<h2 id="down-the-search-tree"><a class="header" href="#down-the-search-tree">Down the Search Tree</a></h2>
<p>In Rust we write type definitions and trait implementations separately—we refer to trait implementations as “impl blocks.” The inner compiler component called the <em>trait solver</em> is responsible for answering queries like “Does <code>{login}</code> implement <code>Handler</code>?” such queries appear as trait bounds in the source code. The trait solver searches through the impl blocks trying to find whether or not the trait bound holds.</p>
<p>In this post we will be using the <em>search tree</em> a data structure produced by the trait solver that describes how it searched impl blocks, and why—or why not—a particular trait bound holds.</p>
<p>Here’s an illustrative diagram of the Axum-error search tree. Argus provides the search tree in a different format, similar to a directory tree, as you shall see further on.</p>
<p>Here’s an illustrative diagram of the Axum-error search tree. Argus provides the search tree in a different format, similar to a directory tree, as you will see further on.</p>
<pre class="mermaid">---
title: Search tree produced by the Axum trait error
---
Expand Down Expand Up @@ -282,7 +282,7 @@ <h2 id="down-the-search-tree"><a class="header" href="#down-the-search-tree">Dow
Fut = Future&lt;Output = Res&gt;
Res = bool
</code></pre>
<p>and add the where-clause constraints as children of the impl block. Notice the constraint <code>Res: IntoResponse</code>, given that <code>Res = bool</code>, the constraint requires that booleans implement <code>IntoResponse</code>, but they don’t. This is one of the root causes of the error and we shal look at how to fix the problem in the following section. But before we jump back to the code and start fixing issues, let’s reflect on the Argus interface and see how we can reach the same conclusion faster.</p>
<p>and add the where-clause constraints as children of the impl block. Notice the constraint <code>Res: IntoResponse</code>, given that <code>Res = bool</code>, the constraint requires that booleans implement <code>IntoResponse</code>, but they don’t. This is one of the root causes of the error and we will look at how to fix the problem in the following section. But before we jump back to the code and start fixing issues, let’s reflect on the Argus interface and see how we can reach the same conclusion faster.</p>
<p style="text-align:center"><img src="assets/axum-hello-server/top-down-error-highlighted.png" alt="Search tree found impl" width="600"></p>
<p>The screenshots included so far of the trait search tree are from the Top-Down view in Argus. This means we view the search just as Rust performed it: We started at the root question <code>{login}: Handler&lt;_, _&gt;</code>, descended into the impl blocks, and found the failing where-clause in a tree leaf—highlighted in red. There’s a second failing bound, but we’ll come back to that in the next section. The insight is that errors are <em>leaves</em> in the search tree, so the Top-Down view doesn’t prioritize showing you errors, but rather the full trait solving process.</p>
<h2 id="up-the-search-tree"><a class="header" href="#up-the-search-tree">Up the Search Tree</a></h2>
Expand Down

0 comments on commit 41b449f

Please sign in to comment.