Skip to content

Commit a7436cf

Browse files
committed
txs auto checkin
1 parent e67ae64 commit a7436cf

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

rust.tex

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,7 +2582,72 @@ \section{Fearless Concurrency}
25822582
\inputminted{rust}{./code/thread6.rs}
25832583
\end{frame}
25842584

2585+
\begin{frame}[fragile]
2586+
\frametitle{Channels and Ownership Transference}
2587+
\inputminted{shell}{./code/thread6.shell}
2588+
\end{frame}
2589+
2590+
2591+
\begin{frame}[fragile]
2592+
\frametitle{Creating Multiple Producers by Cloning the Transmitter}
2593+
2594+
2595+
\begin{columns}
2596+
\column{0.5\textwidth}
2597+
\inputminted{rust}{./code/thread7.rs}
2598+
2599+
\column{0.5\textwidth}
2600+
\inputminted[firstnumber=15]{rust}{./code/thread8.rs}
2601+
\end{columns}
2602+
\end{frame}
2603+
2604+
2605+
\begin{frame}[fragile]
2606+
\frametitle{Shared-State Concurrency}
2607+
\begin{itemize}
2608+
\item \textbf{Message passing} is a fine way of handling concurrency, but\textbf{ it’s not the only one}. Another method would be for multiple \textbf{threads to access the same shared data}.
2609+
\item In a way, \textbf{channels} in any programming language are \textbf{similar to single ownership}, because once you transfer a value down a channel, you should no longer use that value. \textbf{Shared memory} concurrency is like \textbf{multiple ownership}: multiple threads can access the same memory location at the same time.
2610+
\end{itemize}
2611+
\end{frame}
2612+
2613+
25852614
\section{Object-Oriented Programming Features of Rust}
2615+
2616+
\begin{frame}[fragile]
2617+
\frametitle{Objects Contain Data and Behavior}
2618+
\begin{block}{The book Design Patterns (The Gang of Four): }
2619+
Object-oriented programs are made up of objects. An object packages both \textbf{data} and the \textbf{procedures that operate on that data}. The procedures are typically called methods or operations.
2620+
\end{block}
2621+
2622+
\begin{itemize}
2623+
\item Using this definition, \textbf{Rust is object-oriented}: structs and enums have data, and impl blocks provide methods on structs and enums.
2624+
\end{itemize}
2625+
\end{frame}
2626+
2627+
2628+
\begin{frame}[fragile]
2629+
\frametitle{Inheritance}
2630+
2631+
\begin{itemize}
2632+
\item Inheritance is a mechanism whereby an object can inherit elements from another object’s definition, thus gaining the parent object’s data and behavior without you having to define them again.
2633+
\begin{itemize}
2634+
\item If a language must have inheritance to be an object-oriented language, then \textbf{Rust is not one}.
2635+
\item You can do this in a limited way in Rust code using default trait method implementations.
2636+
\end{itemize}
2637+
2638+
\end{itemize}
2639+
\end{frame}
2640+
2641+
2642+
\begin{frame}[fragile]
2643+
\frametitle{Encapsulation}
2644+
2645+
\begin{itemize}
2646+
\item Another aspect commonly associated with OOP is the idea of encapsulation, which means that the implementation details of an object aren’t accessible to code using that object.
2647+
\end{itemize}
2648+
\end{frame}
2649+
2650+
25862651
\section{Patterns and Matching}
25872652
\section{Advanced Features}
25882653
\section{Multithread Web Server}

0 commit comments

Comments
 (0)