1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/// A trait which represents an infallible cast from one type to another.
///
/// Implementations must guarantee that the conversion is always valid and
/// does not lose information.
/// A trait which represents an infallible cast into `Self` from another type.
///
/// See [Cast] for more information.
/// A trait which represents a potentially lossy cast from one type to another.
///
/// A lossy cast always performs the conversion, even when information may be
/// discarded. This may include reduced precision, truncation, clamping, or
/// other changes to the original value.
/// A trait which represents a potentially lossy cast into `Self` from another type.
///
/// See [LossyCast] for more information.
/// A trait which represents a saturating cast from one type to another.
///
/// A saturating cast always performs the conversion. If the value is outside
/// the range representable by the target type, it is clamped to the nearest
/// representable value.
///
/// Non-finite floating-point values are handled as out-of-range values:
/// NaN converts to zero, positive infinity converts to the target maximum,
/// and negative infinity converts to the target minimum.
/// A trait which represents a saturating cast into `Self` from another type.
///
/// See [SaturatingCast] for more information.
/// A trait which represents a cast from one type to the corresponding signed type.
/// A trait which represents a cast into `Self` from another type that is the corresponding signed type.
/// A trait which represents a cast from one type to the corresponding unsigned type.
/// A trait which represents a fallible cast that preserves the value exactly.
///
/// The conversion succeeds only when the value can be represented exactly
/// by the target type. Conversions which would lose precision or otherwise
/// alter the value return an error.
/// A trait which represents a fallible cast into `Self` from another type that preserves the value exactly.
///
/// See [TryExactCast] for more information.
/// A trait which represents a fallible cast between types.
///
/// The conversion succeeds when the value can be represented by the target
/// type according to the target type's conversion rules. Conversions which
/// cannot be performed safely return an error.
/// A trait which represents a fallible cast into `Self` from another type.
///
/// See [TryCast] for more information.
/// An error returned by fallible cast operations.