Struct Number

Source
pub struct Number<'base> { /* private fields */ }

Implementations§

Source§

impl<'base> Number<'base>

Source

pub fn new(base: &'base Base) -> Self

Source

pub fn with_capacity(base: &'base Base, digits: usize) -> Self

Source

pub fn digits(&self) -> usize

Source

pub fn power(&self) -> isize

Source

pub fn sign(&self) -> Sign

Source

pub fn positive(&self) -> bool

Source

pub fn negative(&self) -> bool

Source

pub fn get(&self, idx: usize) -> Option<Digit>

Vector API

Source

pub fn set(&mut self, idx: usize, digit: Digit)

Source

pub fn push_high(&mut self, digit: Digit)

Adds a new digit to the highest-order position

Source

pub fn pop_high(&mut self) -> Option<Digit>

Removes the digit from the highest order position, and returns it (if it exists)

Source

pub fn push_low(&mut self, digit: Digit)

Adds a new digit to the lowest-order position

Source

pub fn pop_low(&mut self) -> Option<Digit>

Removes the digit from the lowest order position, and returns it (if it exists)

Source

pub fn add_digit(&mut self, digit: Digit, power: isize)

Source

pub fn negate(&mut self)

Source

pub fn iter(&self) -> BorrowedNumberIter<'_>

Trait Implementations§

Source§

impl<'base> Debug for Number<'base>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Shl<usize> for Number<'_>

Source§

type Output = Number<'_>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: usize) -> Self::Output

Performs the << operation. Read more
Source§

impl Shr<usize> for Number<'_>

Source§

type Output = Number<'_>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: usize) -> Self::Output

Performs the >> operation. Read more

Auto Trait Implementations§

§

impl<'base> Freeze for Number<'base>

§

impl<'base> RefUnwindSafe for Number<'base>

§

impl<'base> Send for Number<'base>

§

impl<'base> Sync for Number<'base>

§

impl<'base> Unpin for Number<'base>

§

impl<'base> UnwindSafe for Number<'base>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.