pub trait ToSci: Sized {
    fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result;
    fn fmt_sci_valid(&self, options: ToSciOptions) -> bool;

    fn to_sci_with_options(&self, options: ToSciOptions) -> SciWrapper<'_, Self> { ... }
    fn to_sci(&self) -> SciWrapper<'_, Self> { ... }
}
Expand description

Converts a number to a string, possibly in scientific notation.

Required Methods

Formats a number, possibly in scientific notation.

Determines whether some formatting options can be applied to a number.

Provided Methods

Converts a number to a string, possibly in scientific notation.

Converts a number to a string, possibly in scientific notation, using the default ToSciOptions.

Implementations on Foreign Types

Determines whether an unsigned number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether an unsigned number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether an unsigned number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether an unsigned number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether an unsigned number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether an unsigned number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether a signed number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether a signed number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether a signed number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether a signed number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether a signed number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Determines whether a signed number can be converted to a string using to_sci_with_options and a particular set of options.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.

See ToSciOptions for details on the available options. Note that setting neg_exp_threshold has no effect, since there is never a need to use negative exponents when representing an integer.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if options.rounding_mode is Exact, but the size options are such that the input must be rounded.

Examples

See here.

Implementors