From 27e3f853b0cb5e0d3f33543781bb54c89b393eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Chass=C3=A9=20St-Laurent?= Date: Fri, 18 Oct 2019 17:03:59 -0400 Subject: [PATCH] NumCast: document when `from` can return `None` --- src/cast.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cast.rs b/src/cast.rs index c1bd9b6..4dc1b5a 100644 --- a/src/cast.rs +++ b/src/cast.rs @@ -639,7 +639,8 @@ pub fn cast(n: T) -> Option { /// An interface for casting between machine scalars. pub trait NumCast: Sized + ToPrimitive { /// Creates a number from another value that can be converted into - /// a primitive via the `ToPrimitive` trait. + /// a primitive via the `ToPrimitive` trait. If the source value cannot be + /// represented by the target type, then `None` is returned. fn from(n: T) -> Option; }