We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
from
None
1 parent 16cdce3 commit 27e3f85Copy full SHA for 27e3f85
src/cast.rs
@@ -639,7 +639,8 @@ pub fn cast<T: NumCast, U: NumCast>(n: T) -> Option<U> {
639
/// An interface for casting between machine scalars.
640
pub trait NumCast: Sized + ToPrimitive {
641
/// Creates a number from another value that can be converted into
642
- /// a primitive via the `ToPrimitive` trait.
+ /// a primitive via the `ToPrimitive` trait. If the source value cannot be
643
+ /// represented by the target type, then `None` is returned.
644
fn from<T: ToPrimitive>(n: T) -> Option<Self>;
645
}
646
0 commit comments