Skip to content

Commit

Permalink
deploy: b58cc42
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Oct 25, 2023
1 parent ed0e3c5 commit 077ef6b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ch12-03-improving-error-handling-and-modularity.html
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ <h3 id="將程式碼拆到函式庫-crate"><a class="header" href="#將程式碼
<p><span class="caption">範例 12-14:在 <em>src/main.rs</em> 使用 <code>minigrep</code> 函式庫 crate</span></p>
<p>我們加上 <code>use minigrep::Config</code> 這行來將 <code>Config</code> 型別從函式庫 crate 引入執行檔 crate 的作用域中,然後我們使用 <code>run</code> 函式的方式是在其前面再加上 crate 的名稱。現在所有的功能都應該正常並能執行了。透過 <code>cargo run</code> 來執行程式並確保一切正常。</p>
<p>哇!辛苦了,不過我們為未來的成功打下了基礎。現在處理錯誤就輕鬆多了,而且我們讓程式更模組化。現在幾乎所有的工作都會在 <em>src/lib.rs</em> 中進行。</p>
<p>讓我們利用這個新的模組化優勢來進行些原本在就程式碼會很難處理的工作,但在新的程式碼會變得非常容易,那就是寫些測試!</p>
<p>讓我們利用這個新的模組化優勢來進行些原本在舊程式碼會很難處理的工作,但在新的程式碼會變得非常容易,那就是寫些測試!</p>

</main>

Expand Down
2 changes: 1 addition & 1 deletion print.html
Original file line number Diff line number Diff line change
Expand Up @@ -9034,7 +9034,7 @@ <h3 id="將程式碼拆到函式庫-crate"><a class="header" href="#將程式碼
<p><span class="caption">範例 12-14:在 <em>src/main.rs</em> 使用 <code>minigrep</code> 函式庫 crate</span></p>
<p>我們加上 <code>use minigrep::Config</code> 這行來將 <code>Config</code> 型別從函式庫 crate 引入執行檔 crate 的作用域中,然後我們使用 <code>run</code> 函式的方式是在其前面再加上 crate 的名稱。現在所有的功能都應該正常並能執行了。透過 <code>cargo run</code> 來執行程式並確保一切正常。</p>
<p>哇!辛苦了,不過我們為未來的成功打下了基礎。現在處理錯誤就輕鬆多了,而且我們讓程式更模組化。現在幾乎所有的工作都會在 <em>src/lib.rs</em> 中進行。</p>
<p>讓我們利用這個新的模組化優勢來進行些原本在就程式碼會很難處理的工作,但在新的程式碼會變得非常容易,那就是寫些測試!</p>
<p>讓我們利用這個新的模組化優勢來進行些原本在舊程式碼會很難處理的工作,但在新的程式碼會變得非常容易,那就是寫些測試!</p>
<div style="break-before: page; page-break-before: always;"></div><h2 id="透過測試驅動開發完善函式庫功能"><a class="header" href="#透過測試驅動開發完善函式庫功能">透過測試驅動開發完善函式庫功能</a></h2>
<p>現在我們提取邏輯到 <em>src/lib.rs</em> 並在 <em>src/main.rs</em> 留下引數收集與錯誤處理的任務,現在對程式碼中的核心功能進行測試會簡單許多。我們可以使用各種引數直接呼叫函式來檢查回傳值,而不用從命令列呼叫我們的執行檔。</p>
<p>在此段落中,我們會在 <code>minigrep</code> 程式中利用測試驅動開發(Test-driven development,TDD)來新增搜尋邏輯。此程式開發技巧遵循以下步驟:</p>
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.

0 comments on commit 077ef6b

Please sign in to comment.