Refer to other conversion method in documentation

This is motivated by #235 hoping to improve discoverability of this
feature.
This commit is contained in:
Eduard Bopp 2017-07-28 20:12:07 +02:00
parent 7a62b68c38
commit 9e02b13f3e

View File

@ -444,12 +444,16 @@ pub fn distance_squared<P: EuclideanSpace>(p1: &P, p2: &P) -> P::Real {
* Cast
*/
/// Converts an object from one type to an equivalent or more general one.
///
/// See also `::try_convert` for conversion to more specific types.
#[inline]
pub fn convert<From, To: SupersetOf<From>>(t: From) -> To {
To::from_subset(&t)
}
/// Attempts to convert an object to a more specific one.
///
/// See also `::convert` for conversion to more general types.
#[inline]
pub fn try_convert<From: SupersetOf<To>, To>(t: From) -> Option<To> {
t.to_subset()