Crate numeric_constant_traits

Source
Expand description

Traits for generic numeric constants

Like the traits Zero and One from the num crate, but for all natural numbers up to and including 100. Allows doing generic arithmetic without having to do casts.

Without this crate you’d need to do something like:

2u8.into() * 3u8.into() + 4u8.into()

Which is okay, but obfuscates a bit what the intent is.

With this crate you can do something like this:

T::two() * T::three() + T::four()

The traits are implemented for all standard numeric types, as well as a blanket implementation for num::Complex<T>, where T is any of the standar numeric types.

Structs§

Complex
A complex number in Cartesian form.

Traits§

Eight
Returns the constant value for the number eight
Eighteen
Returns the constant value for the number eighteen
Eighty
Returns the constant value for the number eighty
EightyEight
Returns the constant value for the number eighty_eight
EightyFive
Returns the constant value for the number eighty_five
EightyFour
Returns the constant value for the number eighty_four
EightyNine
Returns the constant value for the number eighty_nine
EightyOne
Returns the constant value for the number eighty_one
EightySeven
Returns the constant value for the number eighty_seven
EightySix
Returns the constant value for the number eighty_six
EightyThree
Returns the constant value for the number eighty_three
EightyTwo
Returns the constant value for the number eighty_two
Eleven
Returns the constant value for the number eleven
Fifteen
Returns the constant value for the number fifteen
Fifty
Returns the constant value for the number fifty
FiftyEight
Returns the constant value for the number fifty_eight
FiftyFive
Returns the constant value for the number fifty_five
FiftyFour
Returns the constant value for the number fifty_four
FiftyNine
Returns the constant value for the number fifty_nine
FiftyOne
Returns the constant value for the number fifty_one
FiftySeven
Returns the constant value for the number fifty_seven
FiftySix
Returns the constant value for the number fifty_six
FiftyThree
Returns the constant value for the number fifty_three
FiftyTwo
Returns the constant value for the number fifty_two
Five
Returns the constant value for the number five
Forty
Returns the constant value for the number forty
FortyEight
Returns the constant value for the number forty_eight
FortyFive
Returns the constant value for the number forty_five
FortyFour
Returns the constant value for the number forty_four
FortyNine
Returns the constant value for the number forty_nine
FortyOne
Returns the constant value for the number forty_one
FortySeven
Returns the constant value for the number forty_seven
FortySix
Returns the constant value for the number forty_six
FortyThree
Returns the constant value for the number forty_three
FortyTwo
Returns the constant value for the number forty_two
Four
Returns the constant value for the number four
Fourteen
Returns the constant value for the number fourteen
Nine
Returns the constant value for the number nine
Nineteen
Returns the constant value for the number nineteen
Ninety
Returns the constant value for the number ninety
NinetyEight
Returns the constant value for the number ninety_eight
NinetyFive
Returns the constant value for the number ninety_five
NinetyFour
Returns the constant value for the number ninety_four
NinetyNine
Returns the constant value for the number ninety_nine
NinetyOne
Returns the constant value for the number ninety_one
NinetySeven
Returns the constant value for the number ninety_seven
NinetySix
Returns the constant value for the number ninety_six
NinetyThree
Returns the constant value for the number ninety_three
NinetyTwo
Returns the constant value for the number ninety_two
One
Defines a multiplicative identity element for Self.
OneHundred
Returns the constant value for the number one_hundred
Seven
Returns the constant value for the number seven
Seventeen
Returns the constant value for the number seventeen
Seventy
Returns the constant value for the number seventy
SeventyEight
Returns the constant value for the number seventy_eight
SeventyFive
Returns the constant value for the number seventy_five
SeventyFour
Returns the constant value for the number seventy_four
SeventyNine
Returns the constant value for the number seventy_nine
SeventyOne
Returns the constant value for the number seventy_one
SeventySeven
Returns the constant value for the number seventy_seven
SeventySix
Returns the constant value for the number seventy_six
SeventyThree
Returns the constant value for the number seventy_three
SeventyTwo
Returns the constant value for the number seventy_two
Six
Returns the constant value for the number six
Sixteen
Returns the constant value for the number sixteen
Sixty
Returns the constant value for the number sixty
SixtyEight
Returns the constant value for the number sixty_eight
SixtyFive
Returns the constant value for the number sixty_five
SixtyFour
Returns the constant value for the number sixty_four
SixtyNine
Returns the constant value for the number sixty_nine
SixtyOne
Returns the constant value for the number sixty_one
SixtySeven
Returns the constant value for the number sixty_seven
SixtySix
Returns the constant value for the number sixty_six
SixtyThree
Returns the constant value for the number sixty_three
SixtyTwo
Returns the constant value for the number sixty_two
Ten
Returns the constant value for the number ten
Thirteen
Returns the constant value for the number thirteen
Thirty
Returns the constant value for the number thirty
ThirtyEight
Returns the constant value for the number thirty_eight
ThirtyFive
Returns the constant value for the number thirty_five
ThirtyFour
Returns the constant value for the number thirty_four
ThirtyNine
Returns the constant value for the number thirty_nine
ThirtyOne
Returns the constant value for the number thirty_one
ThirtySeven
Returns the constant value for the number thirty_seven
ThirtySix
Returns the constant value for the number thirty_six
ThirtyThree
Returns the constant value for the number thirty_three
ThirtyTwo
Returns the constant value for the number thirty_two
Three
Returns the constant value for the number three
Twelve
Returns the constant value for the number twelve
Twenty
Returns the constant value for the number twenty
TwentyEight
Returns the constant value for the number twenty_eight
TwentyFive
Returns the constant value for the number twenty_five
TwentyFour
Returns the constant value for the number twenty_four
TwentyNine
Returns the constant value for the number twenty_nine
TwentyOne
Returns the constant value for the number twenty_one
TwentySeven
Returns the constant value for the number twenty_seven
TwentySix
Returns the constant value for the number twenty_six
TwentyThree
Returns the constant value for the number twenty_three
TwentyTwo
Returns the constant value for the number twenty_two
Two
Returns the constant value for the number two
Zero
Defines an additive identity element for Self.