1 00:00:05,660 --> 00:00:12,680 The from an end to traits are going to allow us to perform conversions on a value of one type and then 2 00:00:12,680 --> 00:00:13,790 return it as another. 3 00:00:14,510 --> 00:00:19,490 So the definition for N2 is right here. 4 00:00:19,700 --> 00:00:23,480 So we're going to take our self and then return. 5 00:00:24,840 --> 00:00:29,430 Value of type T and then from is very similar. 6 00:00:29,430 --> 00:00:35,190 But we're going to go from a value of type T and then return our self to it. 7 00:00:36,390 --> 00:00:37,080 So. 8 00:00:37,840 --> 00:00:45,100 Trump is going to serve as a generic constructor for producing an instance of a type from some other 9 00:00:45,100 --> 00:00:46,180 single value. 10 00:00:48,110 --> 00:00:49,840 We define our own types. 11 00:00:49,850 --> 00:00:56,720 If it has a single argument constructors, we should write them as implementations of from. 12 00:00:57,890 --> 00:00:59,510 From the appropriate types. 13 00:00:59,630 --> 00:01:04,820 Rust is friendly and will give us the corresponding end to implementations. 14 00:01:05,660 --> 00:01:09,860 So there is also a try from an A try into. 15 00:01:10,860 --> 00:01:18,270 So imagine trying to implement from an integer of 64 for an AI 32. 16 00:01:18,690 --> 00:01:22,650 Any other case would result in information being lost. 17 00:01:22,650 --> 00:01:22,910 Right? 18 00:01:22,920 --> 00:01:28,290 Because we're going from 64 bits down to 32, so we're going to truncate it in half resulting in lost 19 00:01:28,290 --> 00:01:28,890 bits. 20 00:01:29,190 --> 00:01:38,700 Try and try into are naturally very similar to from and into but try from and try into. 21 00:01:38,700 --> 00:01:40,290 Are the error catchers. 22 00:01:41,460 --> 00:01:44,970 So if we come down here and look at. 23 00:01:45,810 --> 00:01:47,370 It's a required methods. 24 00:01:47,370 --> 00:01:54,150 We can see that we're having a result return of self and self air and we'll be able to make more sense 25 00:01:54,150 --> 00:01:59,340 of this when we learn about airs in the coming lectures. 26 00:01:59,820 --> 00:02:02,040 But I just wanted to introduce this to you. 27 00:02:02,580 --> 00:02:09,720 So the methods try from and try into are going to give us a result and then we can choose what to do 28 00:02:09,720 --> 00:02:12,930 in the case we are thrown an exception a.k.a an error. 29 00:02:14,100 --> 00:02:17,910 And again, we will cover air handling more in a couple of sections. 30 00:02:18,540 --> 00:02:23,820 But I just wanted to show this to you as it's going to allow us to extend the simplicity of from an 31 00:02:23,820 --> 00:02:24,410 end to. 32 00:02:24,600 --> 00:02:30,510 And then with all these utility traits and there are more of them, I just wanted to introduce to you 33 00:02:30,900 --> 00:02:32,070 their concepts. 34 00:02:32,070 --> 00:02:37,140 So as you begin to see them later in this course, we're able to make better sense of them.