Struct lib::NumeralSystem [−][src]
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]
impl NumeralSystempub fn new(entry: Vec<Vec<&str>>) -> Result<NumeralSystem, BibiError>[src]
pub fn new(entry: Vec<Vec<&str>>) -> Result<NumeralSystem, BibiError>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]
pub fn new_from_strings(
entry: Vec<Vec<String>>
) -> Result<NumeralSystem, BibiError>Same as ::new but from vec of strings.
pub fn new_from_tag(tag: &str) -> Result<NumeralSystem, BibiError>[src]
pub fn new_from_tag(tag: &str) -> Result<NumeralSystem, BibiError>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]
pub fn get_digit(&self, which: usize) -> Option<String>Returns the digit at the position usize
pub fn len(&self) -> usize[src]
pub fn len(&self) -> usizeReturns the legth of a digit (all digits have the same length)
pub fn radix(&self) -> usize[src]
pub fn radix(&self) -> usizeReturn the radix of this numeral system (= number of digits in numeral system)
Trait Implementations
impl Debug for NumeralSystem[src]
impl Debug for NumeralSystemfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Display for NumeralSystem[src]
impl Display for NumeralSystemAuto Trait Implementations
impl Send for NumeralSystem
impl Send for NumeralSystemimpl Sync for NumeralSystem
impl Sync for NumeralSystem