Module traits

Source
Expand description

Various traits for converting numbers.

Traits§

ConvertibleFrom
Tests whether a value of one type is convertible into a value of another.
Digits
Expresses a value as a Vec of digits, or reads a value from an iterator of digits.
ExactFrom
Converts a value from one type to another. If the conversion fails, the function panics.
ExactInto
Converts a value from one type to another. If the conversion fails, the function panics.
FromOtherTypeSlice
Converts a slice of one type of value to a single value of another type.
FromSciString
Converts a &str, possibly in scientific notation, to a number.
FromStringBase
Converts a string slice in a given base to a value.
HasHalf
Associates with Self a type that’s half Self’s size.
IntegerMantissaAndExponent
Converts a number to or from an integer mantissa and exponent.
IsInteger
Determines whether a number is an integer.
JoinHalves
Provides a function to join two pieces into a number. For example, two u32s may be joined to form a u64.
OverflowingFrom
Converts a value from one type to another, where if the conversion is not exact the result will wrap around. The result is returned along with a bool that indicates whether wrapping has occurred.
OverflowingInto
Converts a value from one type to another, where if the conversion is not exact the result will wrap around. The result is returned along with a bool that indicates whether wrapping has occurred.
PowerOf2DigitIterable
Creates an iterator over a value’s base-$2^k$ digits.
PowerOf2DigitIterator
An iterator over a value’s base-$2^k$ digits.
PowerOf2Digits
Expresses a value as a Vec of base-$2^k$ digits, or reads a value from an iterator of base-$2^k$ digits.
RawMantissaAndExponent
Converts a number to or from a raw mantissa and exponent.
RoundingFrom
Converts a value from one type to another, where the conversion is made according to a specified RoundingMode. An Ordering is also returned, indicating whether the returned value is less than, equal to, or greater than the original value.
RoundingInto
Converts a value from one type to another, where the conversion is made according to a specified RoundingMode. An Ordering is also returned, indicating whether the returned value is less than, equal to, or greater than the original value.
SaturatingFrom
Converts a value from one type to another, where if the conversion is not exact the result is set to the maximum or minimum value of the result type, whichever is closer.
SaturatingInto
Converts a value from one type to another, where if the conversion is not exact the result is set to the maximum or minimum value of the result type, whichever is closer.
SciMantissaAndExponent
Converts a number to or from a scientific mantissa and exponent.
SplitInHalf
Provides functions to split a number into two pieces. For example, a u64 may be split into two u32s.
ToSci
Converts a number to a string, possibly in scientific notation.
ToStringBase
Converts a number to a string using a specified base.
VecFromOtherType
Converts a slice of one type of value to a Vec of another type.
VecFromOtherTypeSlice
Converts a slice of one type of value to a Vec of another type.
WrappingFrom
Converts a value from one type to another. where if the conversion is not exact the result will wrap around.
WrappingInto
Converts a value from one type to another, where if the conversion is not exact the result will wrap around.