Skip to content

Commit 19cd239

Browse files
committed
txs auto checkin
1 parent c4d7beb commit 19cd239

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

rust.tex

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,6 +2693,37 @@ \section{Object-Oriented Programming Features of Rust}
26932693

26942694

26952695
\section{Patterns and Matching}
2696+
2697+
2698+
\begin{frame}[fragile]
2699+
\frametitle{Patterns}
2700+
\begin{itemize}
2701+
\item Using \textbf{patterns} in conjunction with match expressions and other constructs gives you more control over a program’s control flow.
2702+
\item Some example patterns include \mintinline{rust}|x|, \mintinline{rust}|(a, 3)|, and \mintinline{rust}|Some(Color::Red)|. In the contexts in which patterns are valid, these components describe the shape of data.
2703+
\end{itemize}
2704+
\end{frame}
2705+
2706+
\begin{frame}[fragile]
2707+
\frametitle{Patterns in match Arms}
2708+
\inputminted{rust}{./code/match1.rs}
2709+
2710+
\begin{itemize}
2711+
\item The patterns in this match expression are the None and Some(i) on the left of each arrow.
2712+
\item One requirement for match expressions is that they need to be exhaustive in the sense that all possibilities for the value in the match expression must be accounted for.
2713+
\end{itemize}
2714+
\end{frame}
2715+
2716+
2717+
\begin{frame}[fragile]
2718+
\frametitle{Patterns in Conditional if let Expressions}
2719+
\inputminted{rust}{./code/pattern1.rs}
2720+
\end{frame}
2721+
2722+
\begin{frame}[fragile]
2723+
\frametitle{Patterns in while and for}
2724+
\inputminted{rust}{./code/pattern2.rs}
2725+
\end{frame}
2726+
26962727
\section{Advanced Features}
26972728
\section{Multithread Web Server}
26982729
\section{Tokio}

0 commit comments

Comments
 (0)