pub trait ToStringBase {
// Required methods
fn to_string_base(&self, base: u8) -> String;
fn to_string_base_upper(&self, base: u8) -> String;
}Expand description
Converts a number to a string using a specified base.
Required Methods§
Sourcefn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts a signed number to a lowercase string using a specified base.
Sourcefn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts a signed number to an uppercase string using a specified base.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ToStringBase for i8
impl ToStringBase for i8
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for i16
impl ToStringBase for i16
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for i32
impl ToStringBase for i32
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for i64
impl ToStringBase for i64
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for i128
impl ToStringBase for i128
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for isize
impl ToStringBase for isize
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts a signed number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for u8
impl ToStringBase for u8
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for u16
impl ToStringBase for u16
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for u32
impl ToStringBase for u32
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for u64
impl ToStringBase for u64
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for u128
impl ToStringBase for u128
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§impl ToStringBase for usize
impl ToStringBase for usize
Source§fn to_string_base(&self, base: u8) -> String
fn to_string_base(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
lowercase chars ‘a’ to ‘z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.
Source§fn to_string_base_upper(&self, base: u8) -> String
fn to_string_base_upper(&self, base: u8) -> String
Converts an unsigned number to a string using a specified base.
Digits from 0 to 9 become chars from ‘0’ to ‘9’. Digits from 10 to 35 become the
uppercase chars ‘A’ to ‘Z’.
§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 base is less than 2 or greater than 36.
§Examples
See here.