[][src]Struct bibicode::NumeralSystem

pub struct NumeralSystem { /* fields omitted */ }

Define a numeral system by enumerating all the digits. The first digit is zero. The radix is equal to the number of digits. One digit can have any number of characters but all digits must have the same length.

Methods

impl NumeralSystem
[src]

pub fn new(entry: Vec<Vec<&str>>) -> Result<NumeralSystem, BibiError>
[src]

Returns new numeral system from the strings given. If several vecs are given to the function, figits will be made by a combination of all vecs.

  • Exemple for decimal system entry must be vec!(vec!("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"))

pub fn new_from_strings(
    entry: Vec<Vec<String>>
) -> Result<NumeralSystem, BibiError>
[src]

Same as ::new but from vec of strings.

pub fn new_from_tag(tag: &str) -> Result<NumeralSystem, BibiError>
[src]

Returns pre-defined numeral systems :

  • dec for decimal
  • hex for hexadecimal
  • bibi for "bibi" as defined by Boby Lapointe
  • bin for binary
  • budu for a test system easy to read
  • utf8 for a test system with UTF8 characters
  • base58 for base58 as used in bitcoin

pub fn get_digit(&self, which: usize) -> Option<String>
[src]

Returns the digit at the position usize

pub fn len(&self) -> usize
[src]

Returns the legth of a digit (all digits have the same length)

pub fn radix(&self) -> usize
[src]

Return the radix of this numeral system (= number of digits in numeral system)

Trait Implementations

impl Debug for NumeralSystem
[src]

impl Display for NumeralSystem
[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T
[src]

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

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]