[][src]Struct based::Base

pub struct Base { /* fields omitted */ }

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.

impl NumeralSystem<i128> for Base[src]

impl NumeralSystem<i16> for Base[src]

impl NumeralSystem<i32> for Base[src]

impl NumeralSystem<i64> for Base[src]

impl NumeralSystem<i8> for Base[src]

impl NumeralSystem<isize> for Base[src]

impl NumeralSystem<u128> for Base[src]

impl NumeralSystem<u16> for Base[src]

fn encode(&self, val: u16) -> Result<String, TryFromIntError>[src]

Never produces Err.

impl NumeralSystem<u32> for Base[src]

impl NumeralSystem<u64> for Base[src]

impl NumeralSystem<u8> for Base[src]

fn encode(&self, val: u8) -> Result<String, TryFromIntError>[src]

Never produces Err.

impl NumeralSystem<usize> for Base[src]

fn encode(&self, val: usize) -> Result<String, TryFromIntError>[src]

Never produces Err.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.