Skip to content

Commit

Permalink
Merge pull request #180 from chengr4/fix-typo-ch13
Browse files Browse the repository at this point in the history
fix typo
  • Loading branch information
weihanglo authored Aug 26, 2023
2 parents d48de12 + aba6889 commit b4f4ef1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ch13-01-closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ let add_one_v4 = |x| x + 1 ;

### `Fn` 特徵以及將獲取的數值移出閉包

一但閉包從其定義的周圍環境獲取了數值的參考或所有權(也就是說被**移入**閉包中),閉包本體的程式碼會定義閉包在之後執行結束後要對參考或數值做什麼事情(也就是說被**移出**閉包)。閉包本體可以做以下的事情:將獲取的數值移出閉包、改變獲取的數值、不改變且不移動數值,或是一開始就不從環境獲取任何值。
一旦閉包從其定義的周圍環境獲取了數值的參考或所有權(也就是說被**移入**閉包中),閉包本體的程式碼會定義閉包在之後執行結束後要對參考或數值做什麼事情(也就是說被**移出**閉包)。閉包本體可以做以下的事情:將獲取的數值移出閉包、改變獲取的數值、不改變且不移動數值,或是一開始就不從環境獲取任何值。

閉包從周圍環境獲取並處理數值的方式會影響閉包會實作哪種特徵,而這些特徵能讓函式與結構體決定它們想使用哪種閉包。閉包會依照閉包本體處理數值的方式,自動實作一種或多種 `Fn` 特徵:

Expand Down

0 comments on commit b4f4ef1

Please sign in to comment.