Skip to content

Commit 27e3f85

Browse files
committed
NumCast: document when from can return None
1 parent 16cdce3 commit 27e3f85

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/cast.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,8 @@ pub fn cast<T: NumCast, U: NumCast>(n: T) -> Option<U> {
639639
/// An interface for casting between machine scalars.
640640
pub trait NumCast: Sized + ToPrimitive {
641641
/// Creates a number from another value that can be converted into
642-
/// a primitive via the `ToPrimitive` trait.
642+
/// a primitive via the `ToPrimitive` trait. If the source value cannot be
643+
/// represented by the target type, then `None` is returned.
643644
fn from<T: ToPrimitive>(n: T) -> Option<Self>;
644645
}
645646

0 commit comments

Comments
 (0)