The from an end to traits are going to allow us to perform conversions on a value of one type and then
return it as another.
So the definition for N2 is right here.
So we're going to take our self and then return.
Value of type T and then from is very similar.
But we're going to go from a value of type T and then return our self to it.
So.
Trump is going to serve as a generic constructor for producing an instance of a type from some other
single value.
We define our own types.
If it has a single argument constructors, we should write them as implementations of from.
From the appropriate types.
Rust is friendly and will give us the corresponding end to implementations.
So there is also a try from an A try into.
So imagine trying to implement from an integer of 64 for an AI 32.
Any other case would result in information being lost.
Right?
Because we're going from 64 bits down to 32, so we're going to truncate it in half resulting in lost
bits.
Try and try into are naturally very similar to from and into but try from and try into.
Are the error catchers.
So if we come down here and look at.
It's a required methods.
We can see that we're having a result return of self and self air and we'll be able to make more sense
of this when we learn about airs in the coming lectures.
But I just wanted to introduce this to you.
So the methods try from and try into are going to give us a result and then we can choose what to do
in the case we are thrown an exception a.k.a an error.
And again, we will cover air handling more in a couple of sections.
But I just wanted to show this to you as it's going to allow us to extend the simplicity of from an
end to.
And then with all these utility traits and there are more of them, I just wanted to introduce to you
their concepts.
So as you begin to see them later in this course, we're able to make better sense of them.