You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rust.tex
+41-2Lines changed: 41 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1984,7 +1984,6 @@ \section{An I/O Project: Building a Command Line Program}
1984
1984
\inputminted{rust}{./code/grep5.rs}
1985
1985
\end{frame}
1986
1986
1987
-
1988
1987
\begin{frame}[fragile]
1989
1988
\frametitle{minigrep - Refactoring (Creating a Constructor for Config)}
1990
1989
\inputminted{rust}{./code/grep6.rs}
@@ -2003,7 +2002,47 @@ \section{An I/O Project: Building a Command Line Program}
2003
2002
2004
2003
\begin{frame}[fragile]
2005
2004
\frametitle{minigrep - Refactoring (Extracting Logic from main)}
2006
-
\inputminted{rust}{./code/grep8.rs}
2005
+
\inputminted{rust}{./code/grep9.rs}
2006
+
\end{frame}
2007
+
2008
+
\begin{frame}[fragile]
2009
+
\frametitle{minigrep - Refactoring (Handling Errors Returned from run in main)}
2010
+
\inputminted{rust}{./code/grep10.rs}
2011
+
\end{frame}
2012
+
2013
+
\begin{frame}[fragile]
2014
+
\frametitle{minigrep - Refactoring (Splitting Code into a Library Crate)}
2015
+
Filename: \mintinline{shell}|src/lib.rs|
2016
+
\inputminted{rust}{./code/grep11.rs}
2017
+
\end{frame}
2018
+
2019
+
\begin{frame}[fragile]
2020
+
\frametitle{minigrep - Refactoring (Splitting Code into a Library Crate(2))}
2021
+
Filename: \mintinline{shell}|src/main.rs|
2022
+
\inputminted{rust}{./code/grep12.rs}
2023
+
\end{frame}
2024
+
2025
+
\begin{frame}[fragile]
2026
+
\frametitle{minigrep - Working with Environment Variables}
2027
+
\inputminted{rust}{./code/grep13.rs}
2028
+
2029
+
\end{frame}
2030
+
2031
+
\begin{frame}[fragile]
2032
+
\frametitle{minigrep - Working with Environment Variables (2)}
2033
+
\begin{itemize}
2034
+
\item The env::var function returns a Result that will be the successful Ok variant that contains the value of the environment variable if the environment variable is set to any value. It will return the Err variant if the environment variable is not set.
2035
+
\item We’re using the \mintinline{rust}|is_ok| method on the Result to check whether the environment variable is set. If the \mintinline{rust}|IGNORE_CASE| environment variable isn’t set to anything, \mintinline{rust}|is_ok| will return false.
2036
+
\end{itemize}
2037
+
\end{frame}
2038
+
2039
+
Writing Error Messages to Standard Error Instead of Standard Output
2040
+
\begin{frame}[fragile]
2041
+
\frametitle{minigrep - Writing Error Messages to Standard Error Instead of Standard Output}
2042
+
\begin{itemize}
2043
+
\item The env::var function returns a Result that will be the successful Ok variant that contains the value of the environment variable if the environment variable is set to any value. It will return the Err variant if the environment variable is not set.
2044
+
\item We’re using the \mintinline{rust}|is_ok| method on the Result to check whether the environment variable is set. If the \mintinline{rust}|IGNORE_CASE| environment variable isn’t set to anything, \mintinline{rust}|is_ok| will return false.
2045
+
\end{itemize}
2007
2046
\end{frame}
2008
2047
2009
2048
\section{Functional Language Features: Iterators and Closures}
0 commit comments