File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -2052,6 +2052,34 @@ \section{An I/O Project: Building a Command Line Program}
20522052
20532053\section {Functional Language Features: Iterators and Closures }
20542054
2055+
2056+ \begin {frame }[fragile]
2057+ \frametitle {Closures: Anonymous Functions that Capture Their Environment}
2058+ \begin {itemize }
2059+ \item Rust’s closures are \textbf {anonymous functions } you can save in a variable or pass as arguments to other functions.
2060+ \item You can create the closure in one place and then call the closure elsewhere to evaluate it in a different context.
2061+ \item Unlike functions, closures \textbf {can capture values from the scope } in which they’re defined.
2062+ \item We’ll demonstrate how these closure features allow for \textbf {code reuse } and \textbf {behavior customization }.
2063+ \end {itemize }
2064+ \end {frame }
2065+
2066+
2067+ \begin {frame }[fragile]
2068+ \frametitle {Capturing the Environment with Closures}
2069+ \begin {itemize }
2070+ \item Rust’s closures are \textbf {anonymous functions } you can save in a variable or pass as arguments to other functions.
2071+ \item You can create the closure in one place and then call the closure elsewhere to evaluate it in a different context.
2072+ \item Unlike functions, closures \textbf {can capture values from the scope } in which they’re defined.
2073+ \item We’ll demonstrate how these closure features allow for \textbf {code reuse } and \textbf {behavior customization }.
2074+ \end {itemize }
2075+ \end {frame }
2076+
2077+ \begin {frame }[fragile]
2078+ \frametitle {Closure Type Inference and Annotation}
2079+ \inputminted {rust}{./code/closure.rs}
2080+ \end {frame }
2081+
2082+
20552083\section {More About Cargo and Crates.io }
20562084\section {Smart Pointers }
20572085\section {Fearless Concurrency }
You can’t perform that action at this time.
0 commit comments