X-Git-Url: https://git.ralfj.de/rust-101.git/blobdiff_plain/5733ee975f1c72c27a4c2530f502786e777a8cc7..c27b94f8e36d136f81f799ca1ae205988cf3d36e:/src/part10.rs?ds=sidebyside diff --git a/src/part10.rs b/src/part10.rs index 66d18ff..0c90369 100644 --- a/src/part10.rs +++ b/src/part10.rs @@ -81,7 +81,7 @@ impl BigInt { pub fn print_with_prefix(b: &BigInt, prefix: String) { //@ The syntax for closures is `|arg1, arg2, ...| code`. Notice that the closure can reference variables like `prefix` that it did not //@ take as argument - variables that happen to be present *outside* of the closure. We say that the closure *captures* - //@ variables. Rust will now automatically create a type (like `PrintWithStruct`) for the environment of the closure + //@ variables. Rust will now automatically create a type (like `PrintWithString`) for the environment of the closure //@ with fields for every captured variable, implement the closure trait for this type such that the action performed //@ is given by the code of the closure, and finally it will instantiate the environment type here at the definition site //@ of the closure and fill it appropriately.