[−][src]Trait based::NumeralSystem
NumeralSystem
provides conversions to and from representations in the given system.
Required methods
fn decode(&self, rep: &str) -> Result<T, StrError>
Given a NumeralSystem
and a number's representation
in that system, return the number.
Returns Err
if this function encounters a character not in the system,
or if an int to int conversion fails.
fn encode(&self, val: T) -> Result<String, TryFromIntError>
Given a NumeralSystem
and a number, return the
representation of that number in the system.
Returns Err
if an int to int conversion fails.
This will interpret signed integers as if their bits represented their unsigned counterparts.
Implementors
impl NumeralSystem<i128> for Base
[src]
fn decode(&self, rep: &str) -> Result<i128, StrError>
[src]
fn encode(&self, val: i128) -> Result<String, TryFromIntError>
[src]
impl NumeralSystem<i16> for Base
[src]
fn decode(&self, rep: &str) -> Result<i16, StrError>
[src]
fn encode(&self, val: i16) -> Result<String, TryFromIntError>
[src]
impl NumeralSystem<i32> for Base
[src]
fn decode(&self, rep: &str) -> Result<i32, StrError>
[src]
fn encode(&self, val: i32) -> Result<String, TryFromIntError>
[src]
impl NumeralSystem<i64> for Base
[src]
fn decode(&self, rep: &str) -> Result<i64, StrError>
[src]
fn encode(&self, val: i64) -> Result<String, TryFromIntError>
[src]
impl NumeralSystem<i8> for Base
[src]
fn decode(&self, rep: &str) -> Result<i8, StrError>
[src]
fn encode(&self, val: i8) -> Result<String, TryFromIntError>
[src]
impl NumeralSystem<isize> for Base
[src]
fn decode(&self, rep: &str) -> Result<isize, StrError>
[src]
fn encode(&self, val: isize) -> Result<String, TryFromIntError>
[src]
impl NumeralSystem<u128> for Base
[src]
fn decode(&self, rep: &str) -> Result<u128, StrError>
[src]
fn encode(&self, val: u128) -> Result<String, TryFromIntError>
[src]
impl NumeralSystem<u16> for Base
[src]
fn decode(&self, rep: &str) -> Result<u16, StrError>
[src]
fn encode(&self, val: u16) -> Result<String, TryFromIntError>
[src]
Never produces Err
.
impl NumeralSystem<u32> for Base
[src]
fn decode(&self, rep: &str) -> Result<u32, StrError>
[src]
fn encode(&self, val: u32) -> Result<String, TryFromIntError>
[src]
impl NumeralSystem<u64> for Base
[src]
fn decode(&self, rep: &str) -> Result<u64, StrError>
[src]
fn encode(&self, val: u64) -> Result<String, TryFromIntError>
[src]
impl NumeralSystem<u8> for Base
[src]
fn decode(&self, rep: &str) -> Result<u8, StrError>
[src]
fn encode(&self, val: u8) -> Result<String, TryFromIntError>
[src]
Never produces Err
.