Fix a bunch of heckin' trailing whitespace
This commit is contained in:
parent
12532277d5
commit
c1d1c6731c
2 changed files with 17 additions and 17 deletions
|
|
@ -366,9 +366,9 @@ pub trait From<T>: Sized {
|
|||
/// provides an equivalent `TryInto` implementation for free, thanks to a
|
||||
/// blanket implementation in the standard library. For more information on this,
|
||||
/// see the documentation for [`Into`].
|
||||
///
|
||||
///
|
||||
/// # Implementing `TryInto`
|
||||
///
|
||||
///
|
||||
/// This suffers the same restrictions and reasoning as implementing
|
||||
/// [`Into`], see there for details.
|
||||
///
|
||||
|
|
@ -387,25 +387,25 @@ pub trait TryInto<T>: Sized {
|
|||
|
||||
/// Simple and safe type conversions that may fail in a controlled
|
||||
/// way under some circumstances. It is the reciprocal of [`TryInto`].
|
||||
///
|
||||
/// This is useful when you are doing a type conversion that may
|
||||
///
|
||||
/// This is useful when you are doing a type conversion that may
|
||||
/// trivially succeed but may also need special handling.
|
||||
/// For example, there is no way to convert an `i64` into an `i32`
|
||||
/// using the [`From`] trait, because an `i64` may contain a value
|
||||
/// that an `i32` cannot represent and so the conversion would lose data.
|
||||
/// This might be handled by truncating the `i64` to an `i32` (essentially
|
||||
/// giving the `i64`'s value modulo `i32::MAX`) or by simply returning
|
||||
/// `i32::MAX`, or by some other method. The `From` trait is intended
|
||||
/// for lossless conversions, so the `TryFrom` trait informs the
|
||||
/// giving the `i64`'s value modulo `i32::MAX`) or by simply returning
|
||||
/// `i32::MAX`, or by some other method. The `From` trait is intended
|
||||
/// for lossless conversions, so the `TryFrom` trait informs the
|
||||
/// programmer when a type conversion could go bad and lets them
|
||||
/// decide how to handle it.
|
||||
///
|
||||
///
|
||||
/// # Generic Implementations
|
||||
///
|
||||
/// - `TryFrom<T> for U` implies [`TryInto<U>`]` for T`
|
||||
/// - [`try_from`] is reflexive, which means that `TryFrom<T> for T`
|
||||
/// - [`try_from`] is reflexive, which means that `TryFrom<T> for T`
|
||||
/// is implemented
|
||||
///
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// As described, [`i32`] implements `TryFrom<i64>`:
|
||||
|
|
@ -416,10 +416,10 @@ pub trait TryInto<T>: Sized {
|
|||
/// // and handling the truncation after the fact.
|
||||
/// let smaller_number = big_number as i32;
|
||||
/// assert_eq!(smaller_number, -727379968);
|
||||
///
|
||||
///
|
||||
/// let try_smaller_number = i32::try_from(big_number);
|
||||
/// assert!(try_smaller_number.is_err());
|
||||
///
|
||||
///
|
||||
/// let try_successful_smaller_number = i32::try_from(3);
|
||||
/// assert!(try_successful_smaller_number.is_ok());
|
||||
/// ```
|
||||
|
|
|
|||
|
|
@ -4564,7 +4564,7 @@ macro_rules! try_from_lower_bounded {
|
|||
|
||||
/// Try to create a target number type from a
|
||||
/// source type that has `source::MIN > dest::MIN`.
|
||||
/// Will return an error if `source` is less than
|
||||
/// Will return an error if `source` is less than
|
||||
/// `dest::MIN`.
|
||||
#[inline]
|
||||
fn try_from(u: $source) -> Result<$target, TryFromIntError> {
|
||||
|
|
@ -4587,7 +4587,7 @@ macro_rules! try_from_upper_bounded {
|
|||
|
||||
/// Try to create a target number type from a
|
||||
/// source type that has `source::MAX > dest::MAX`.
|
||||
/// Will return an error if `source` is greater than
|
||||
/// Will return an error if `source` is greater than
|
||||
/// `dest::MAX`.
|
||||
#[inline]
|
||||
fn try_from(u: $source) -> Result<$target, TryFromIntError> {
|
||||
|
|
@ -4609,9 +4609,9 @@ macro_rules! try_from_both_bounded {
|
|||
type Error = TryFromIntError;
|
||||
|
||||
/// Try to "narrow" a number from the source type
|
||||
/// to the target type. Will return an error if
|
||||
/// the source value is either larger than the
|
||||
/// `MAX` value for the target type or smaller
|
||||
/// to the target type. Will return an error if
|
||||
/// the source value is either larger than the
|
||||
/// `MAX` value for the target type or smaller
|
||||
/// than the `MIN` value for it.
|
||||
#[inline]
|
||||
fn try_from(u: $source) -> Result<$target, TryFromIntError> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue