Two very important traits we need to talk about are sink and sin.
Types that implement sin are safe to pass by value to another thread.
And when I say safe, I mean that they are free from data races and other undefined behavior types that
implements and can also be moved across threads.
Now types that implement sink are safe to pass by non mutable reference to another thread.
These types can be shared across threads so Syn can be moved across threads and sync can be shared across
threads.
Almost every rust type is cind, but there are some exceptions such as our RC reference counter smart
pointer.
So let's take a look at that real quick.
So we'll say let RC one equals a new RC, so a new reference counter smart pointer and we'll say string
from and then we'll just do tests to keep it simple and then we'll say led RC two equals RC one dot
clone and now we'll spawn a thread.
And we'll just try to use RC to in here.
And if we run this.
Let me correct that real quick.
And if we run this, it says our C string cannot be sent between threads safely.
Now, remember, in the last section when we were talking about reference counter, I mentioned the
atomic reference counter.
So let's make this a atomic reference counter.
Which I said is safe to use across threads.
And now we are able to safely use a reference counter smart pointer inside of a thread.
So I just wanted to make you aware of this because these two traits are important to help ensure rust
is safe when using threads.