1/*! # Method-Directed Type Conversion23The `std::convert` module provides traits for converting values from one type to4another. The first of these, [`From<T>`], provides an associated function5[`from(orig: T) -> Self`]. This function can only be called in prefix-position,6as it does not have a `self` receiver. The second, [`Into<T>`], provides a7method [`into(self) -> T`] which *can* be called in suffix-position; due to8intractable problems in the type solver, this method cannot have any *further*9method calls attached to it. It must be bound directly into a `let` or function10call.1112The [`TryFrom<T>`] and [`TryInto<T>`] traits have the same properties, but13permit failure.1415This module provides traits that place the conversion type parameter in the16method, rather than in the trait, so that users can write `.conv::<T>()` to17convert the preceding expression into `T`, without causing any failures in the18type solver. These traits are blanket-implemented on all types that have an19`Into<T>` implementation, which covers both the blanket implementation of `Into`20for types with `From`, and manual implementations of `Into`.2122[`From<T>`]: https://doc.rust-lang.org/std/convert/trait.From.html23[`Into<T>`]: https://doc.rust-lang.org/std/convert/trait.Into.html24[`TryFrom<T>`]: https://doc.rust-lang.org/std/convert/trait.TryFrom.html25[`TryInto<T>`]: https://doc.rust-lang.org/std/convert/trait.TryInto.html26[`from(orig: T) -> Self`]: https://doc.rust-lang.org/std/convert/trait.From.html#tymethod.from27[`into(self) -> T`]: https://doc.rust-lang.org/std/convert/trait.Into.html#tymethod.into28!*/2930usecore::convert::TryInto;3132/// Wraps `Into::<T>::into` as a method that can be placed in pipelines.33pub traitConv34where35Self: Sized,36{37/// Converts `self` into `T` using `Into<T>`.38///39/// # Examples40///41/// ```rust42/// use tap::conv::Conv;43///44/// let len = "Saluton, mondo!"45/// .conv::<String>()46/// .len();47/// ```48#[inline(always)]49fnconv<T>(self) -> T50where51Self: Into<T>,52T: Sized,53{54Into::<T>::into(self)55}56}5758impl<T> ConvforT {}5960/// Wraps `TryInto::<T>::try_into` as a method that can be placed in pipelines.61pub traitTryConv62where63Self: Sized,64{65/// Attempts to convert `self` into `T` using `TryInto<T>`.66///67/// # Examples68///69/// ```rust70/// use tap::conv::TryConv;71///72/// let len = "Saluton, mondo!"73/// .try_conv::<String>()74/// .unwrap()75/// .len();76/// ```77#[inline(always)]78fntry_conv<T>(self) ->Result<T,Self::Error>79where80Self: TryInto<T>,81T: Sized,82{83TryInto::<T>::try_into(self)84}85}8687impl<T> TryConvforT {}