|
4 | 4 |
|
5 | 5 | #![stable(feature = "rust1", since = "1.0.0")]
|
6 | 6 |
|
7 |
| -use crate::convert::TryFrom; |
| 7 | +use crate::convert::{TryFrom, TryInto}; |
8 | 8 | use crate::fmt;
|
9 | 9 | use crate::intrinsics;
|
10 | 10 | use crate::mem;
|
@@ -278,6 +278,28 @@ $EndFeature, "
|
278 | 278 | }
|
279 | 279 | }
|
280 | 280 |
|
| 281 | + doc_comment! { |
| 282 | + "FIXME docs", |
| 283 | + #[stable(feature = "int_inherent_try_from_try_into", since = "1.41.0")] |
| 284 | + #[inline] |
| 285 | + pub fn try_from<T>(value: T) -> Result<Self, <Self as TryFrom<T>>::Error> |
| 286 | + where Self: TryFrom<T> |
| 287 | + { |
| 288 | + TryFrom::try_from(value) |
| 289 | + } |
| 290 | + } |
| 291 | + |
| 292 | + doc_comment! { |
| 293 | + "FIXME docs", |
| 294 | + #[stable(feature = "int_inherent_try_from_try_into", since = "1.41.0")] |
| 295 | + #[inline] |
| 296 | + pub fn try_into<T>(self) -> Result<T, <Self as TryInto<T>>::Error> |
| 297 | + where Self: TryInto<T> |
| 298 | + { |
| 299 | + TryInto::try_into(self) |
| 300 | + } |
| 301 | + } |
| 302 | + |
281 | 303 | doc_comment! {
|
282 | 304 | concat!("Converts a string slice in a given base to an integer.
|
283 | 305 |
|
@@ -2340,6 +2362,28 @@ stringify!($MaxV), ");", $EndFeature, "
|
2340 | 2362 | pub const fn max_value() -> Self { !0 }
|
2341 | 2363 | }
|
2342 | 2364 |
|
| 2365 | + doc_comment! { |
| 2366 | + "FIXME docs", |
| 2367 | + #[stable(feature = "int_inherent_try_from_try_into", since = "1.41.0")] |
| 2368 | + #[inline] |
| 2369 | + pub fn try_from<T>(value: T) -> Result<Self, <Self as TryFrom<T>>::Error> |
| 2370 | + where Self: TryFrom<T> |
| 2371 | + { |
| 2372 | + TryFrom::try_from(value) |
| 2373 | + } |
| 2374 | + } |
| 2375 | + |
| 2376 | + doc_comment! { |
| 2377 | + "FIXME docs", |
| 2378 | + #[stable(feature = "int_inherent_try_from_try_into", since = "1.41.0")] |
| 2379 | + #[inline] |
| 2380 | + pub fn try_into<T>(self) -> Result<T, <Self as TryInto<T>>::Error> |
| 2381 | + where Self: TryInto<T> |
| 2382 | + { |
| 2383 | + TryInto::try_into(self) |
| 2384 | + } |
| 2385 | + } |
| 2386 | + |
2343 | 2387 | doc_comment! {
|
2344 | 2388 | concat!("Converts a string slice in a given base to an integer.
|
2345 | 2389 |
|
|
0 commit comments