pub trait DigitCollection {
    type Fallback: DigitCollection + Default;

    // Required methods
    fn has_zero_digit(&self) -> bool;
    fn len(&self) -> usize;
    fn digit(&self, index: usize) -> char;

    // Provided methods
    fn fixed(&self) -> bool { ... }
    fn zero_based(&self) -> bool { ... }
    fn is_empty(&self) -> bool { ... }
    fn and<Other>(self, other: Other) -> Chain<Self, Other>
       where Self: Sized,
             Other: DigitCollection { ... }
    fn one_based(self) -> OneBased<Self>
       where Self: Sized { ... }
}
Expand description

An ordered collection of digits that can be used as a NominalSystem.

Required Associated Types§

source

type Fallback: DigitCollection + Default

The digit collection that should be used after this collection’s range is exhausted.

Required Methods§

source

fn has_zero_digit(&self) -> bool

Returns true if this collection has a symbol representing 0 at index 0.

source

fn len(&self) -> usize

Returns the number of digits in this collection.

source

fn digit(&self, index: usize) -> char

Returns the digit at location index.

Panics

This function can panic if index >= self.len().

Provided Methods§

source

fn fixed(&self) -> bool

If true, this digit collection can only produce a single digit.

source

fn zero_based(&self) -> bool

Returns true if this collection should start counting at 1 instead of 0. This function is only called if has_zero_digit() returns false.

source

fn is_empty(&self) -> bool

Returns true if this collection’s length is 0.

source

fn and<Other>(self, other: Other) -> Chain<Self, Other>
where Self: Sized, Other: DigitCollection,

Chains self and other into a single DigitCollection.

source

fn one_based(self) -> OneBased<Self>
where Self: Sized,

Returns this collection that indicates counting should start at 1 instead of 0.

This has no effect if the collection has a zero digit.

Implementors§

source§

impl DigitCollection for Bengali

source§

impl DigitCollection for Cambodian

source§

impl DigitCollection for CjkDecimal

source§

impl DigitCollection for CjkEarthlyBranch

source§

impl DigitCollection for CjkHeavenlyStem

source§

impl DigitCollection for Decimal

source§

impl DigitCollection for Devanagari

source§

impl DigitCollection for EasternArabic

source§

impl DigitCollection for GreekLower

source§

impl DigitCollection for GreekUpper

source§

impl DigitCollection for Gujarati

source§

impl DigitCollection for Gurmukhi

source§

impl DigitCollection for HangeulJamo

source§

impl DigitCollection for HangeulSyllable

source§

impl DigitCollection for HexLower

source§

impl DigitCollection for HexUpper

source§

impl DigitCollection for Hiragana

source§

impl DigitCollection for HiraganaIroha

source§

impl DigitCollection for Kannada

source§

impl DigitCollection for Katakana

source§

impl DigitCollection for KatakanaIroha

source§

impl DigitCollection for Lao

source§

impl DigitCollection for LetterLower

source§

impl DigitCollection for LetterUpper

source§

impl DigitCollection for Malayalam

source§

impl DigitCollection for Mongolian

source§

impl DigitCollection for Myanmar

source§

impl DigitCollection for NoFallback

source§

impl DigitCollection for Oriya

source§

impl DigitCollection for Persian

source§

impl DigitCollection for Tamil

source§

impl DigitCollection for Telugu

source§

impl DigitCollection for Thai

source§

impl DigitCollection for Tibetan

source§

impl<A, B> DigitCollection for Chain<A, B>

source§

impl<T> DigitCollection for OneBased<T>
where T: DigitCollection,

source§

impl<T> DigitCollection for Restrict<T>
where T: DigitCollection,

source§

impl<const N: usize> DigitCollection for DigitSet<N, false>

source§

impl<const N: usize> DigitCollection for DigitSet<N, true>