[−][src]Struct based::Base
Base
represents a numeral system with single-character digits.
When creating a new numeral system from a given string slice,
the value of each character is its index in the slice,
e.g. the first character has value 0
, the second has value 1
, etc.
If the given slice has at least one duplicate character, parsing will
produce an Err
.
Examples
use based::*; let base16: based::Base = "0123456789abcdef".parse().unwrap(); assert_eq!("a", base16.encode(10).unwrap());
Trait Implementations
impl Display for Base
[src]
impl FromStr for Base
[src]
type Err = DuplicateCharacterError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
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
.
impl NumeralSystem<usize> for Base
[src]
Auto Trait Implementations
impl RefUnwindSafe for Base
impl Send for Base
impl Sync for Base
impl Unpin for Base
impl UnwindSafe for Base
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,