Struct bibicode::NumeralSystem[][src]

pub struct NumeralSystem { /* fields omitted */ }
Expand description

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.

Implementations

impl NumeralSystem[src]

pub fn autodetect<'a>(
    number: &str,
    nums: Vec<&'a NumeralSystem>
) -> Option<&'a NumeralSystem>
[src]

pub fn new(
    prefix: &str,
    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(
    prefix: String,
    entry: Vec<Vec<String>>
) -> Result<NumeralSystem, BibiError>
[src]

Same as ::new but from vec of strings.

pub fn get_prefixes_from_tags() -> HashMap<String, String>[src]

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

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)

pub fn get_prefix(&self) -> String[src]

pub fn set_prefix(&mut self, prefix: &str)[src]

Trait Implementations

impl Debug for NumeralSystem[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Display for NumeralSystem[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.