[][src]Struct based::Base

pub struct Base { /* fields omitted */ }

Base represents a numeral system with single-character digits.

Methods

impl Base[src]

pub fn new(base: &str) -> Base[src]

Creates a new numeral system from the given string slice.

The value of each character is its index in the slice, e.g. the first character has value 0, the second value 1, etc.

The behavior of this function is undefined when a character is present more than once in the given string slice.

Examples

use based::Base;
  
let base16 = based::Base::new("0123456789abcdef");

Trait Implementations

impl Display for Base[src]

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 digits(&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 digits(&self, val: u8) -> Result<String, TryFromIntError>[src]

Never produces Err.

impl NumeralSystem<usize> for Base[src]

fn digits(&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.