@@ -366,9 +366,9 @@ pub trait From<T>: Sized {
366
366
/// provides an equivalent `TryInto` implementation for free, thanks to a
367
367
/// blanket implementation in the standard library. For more information on this,
368
368
/// see the documentation for [`Into`].
369
- ///
369
+ ///
370
370
/// # Implementing `TryInto`
371
- ///
371
+ ///
372
372
/// This suffers the same restrictions and reasoning as implementing
373
373
/// [`Into`], see there for details.
374
374
///
@@ -387,25 +387,25 @@ pub trait TryInto<T>: Sized {
387
387
388
388
/// Simple and safe type conversions that may fail in a controlled
389
389
/// way under some circumstances. It is the reciprocal of [`TryInto`].
390
- ///
391
- /// This is useful when you are doing a type conversion that may
390
+ ///
391
+ /// This is useful when you are doing a type conversion that may
392
392
/// trivially succeed but may also need special handling.
393
393
/// For example, there is no way to convert an `i64` into an `i32`
394
394
/// using the [`From`] trait, because an `i64` may contain a value
395
395
/// that an `i32` cannot represent and so the conversion would lose data.
396
396
/// This might be handled by truncating the `i64` to an `i32` (essentially
397
- /// giving the `i64`'s value modulo `i32::MAX`) or by simply returning
398
- /// `i32::MAX`, or by some other method. The `From` trait is intended
399
- /// for lossless conversions, so the `TryFrom` trait informs the
397
+ /// giving the `i64`'s value modulo `i32::MAX`) or by simply returning
398
+ /// `i32::MAX`, or by some other method. The `From` trait is intended
399
+ /// for lossless conversions, so the `TryFrom` trait informs the
400
400
/// programmer when a type conversion could go bad and lets them
401
401
/// decide how to handle it.
402
- ///
402
+ ///
403
403
/// # Generic Implementations
404
404
///
405
405
/// - `TryFrom<T> for U` implies [`TryInto<U>`]` for T`
406
- /// - [`try_from`] is reflexive, which means that `TryFrom<T> for T`
406
+ /// - [`try_from`] is reflexive, which means that `TryFrom<T> for T`
407
407
/// is implemented
408
- ///
408
+ ///
409
409
/// # Examples
410
410
///
411
411
/// As described, [`i32`] implements `TryFrom<i64>`:
@@ -416,10 +416,10 @@ pub trait TryInto<T>: Sized {
416
416
/// // and handling the truncation after the fact.
417
417
/// let smaller_number = big_number as i32;
418
418
/// assert_eq!(smaller_number, -727379968);
419
- ///
419
+ ///
420
420
/// let try_smaller_number = i32::try_from(big_number);
421
421
/// assert!(try_smaller_number.is_err());
422
- ///
422
+ ///
423
423
/// let try_successful_smaller_number = i32::try_from(3);
424
424
/// assert!(try_successful_smaller_number.is_ok());
425
425
/// ```
0 commit comments