Trait primitives::unified_num::FromWhole
source · pub trait FromWhole<T>: Sized {
fn from_whole(whole_number: T) -> Self;
fn from_whole_opt(whole_number: T) -> Option<Self>;
}
Expand description
Helper trait for handling the creation of special numbers from a whole number
Required Methods
sourcefn from_whole(whole_number: T) -> Self
fn from_whole(whole_number: T) -> Self
Panics
If the number is greater than one can be represented.
sourcefn from_whole_opt(whole_number: T) -> Option<Self>
fn from_whole_opt(whole_number: T) -> Option<Self>
Same as Self::from_whole
but instead of panicking it returns an Option.