Struct analiticcl::iterators::DeletionResult

source ·
pub struct DeletionResult {
    pub value: AnaValue,
    pub charindex: CharIndexType,
}

Fields§

§value: AnaValue§charindex: CharIndexType

Methods from Deref<Target = AnaValue>§

source

pub fn bit(&self, n: usize) -> bool

Returns true if the n-th bit is set.

§Examples
assert_eq!(ubig!(0b10010).bit(1), true);
assert_eq!(ubig!(0b10010).bit(3), false);
assert_eq!(ubig!(0b10010).bit(100), false);
source

pub fn trailing_zeros(&self) -> Option<usize>

Returns the number of trailing zeros in the binary representation.

In other words, it is the largest n such that 2 to the power of n divides the number.

For 0, it returns None.

§Examples
assert_eq!(ubig!(17).trailing_zeros(), Some(0));
assert_eq!(ubig!(48).trailing_zeros(), Some(4));
assert_eq!(ubig!(0b101000000).trailing_zeros(), Some(6));
assert_eq!(ubig!(0).trailing_zeros(), None);
source

pub fn bit_len(&self) -> usize

Bit length.

The length of the binary representation of the number.

For 0, the length is 0.

For non-zero numbers it is:

  • in_radix(2).to_string().len()
  • the index of the top 1 bit plus one
  • the floor of the logarithm base 2 of the number plus one.
§Examples
assert_eq!(ubig!(17).bit_len(), 5);
assert_eq!(ubig!(0b101000000).bit_len(), 9);
assert_eq!(ubig!(0).bit_len(), 0);
let x = ubig!(_0x90ffff3450897234);
assert_eq!(x.bit_len(), x.in_radix(2).to_string().len());
source

pub fn is_power_of_two(&self) -> bool

True if the number is a power of 2.

§Examples
assert_eq!(ubig!(0).is_power_of_two(), false);
assert_eq!(ubig!(8).is_power_of_two(), true);
assert_eq!(ubig!(9).is_power_of_two(), false);
source

pub fn to_le_bytes(&self) -> Vec<u8>

Return little-endian bytes.

§Examples
assert!(ubig!(0).to_le_bytes().is_empty());
assert_eq!(ubig!(0x010203).to_le_bytes(), [3, 2, 1]);
source

pub fn to_be_bytes(&self) -> Vec<u8>

Return big-endian bytes.

§Examples
assert!(ubig!(0).to_be_bytes().is_empty());
assert_eq!(ubig!(0x010203).to_be_bytes(), [1, 2, 3]);
source

pub fn to_f32(&self) -> f32

Convert to f32.

Round to nearest, breaking ties to even last bit.

§Examples
assert_eq!(ubig!(134).to_f32(), 134.0f32);
source

pub fn to_f64(&self) -> f64

Convert to f64.

Round to nearest, breaking ties to even last bit.

§Examples
assert_eq!(ubig!(134).to_f64(), 134.0f64);
source

pub fn in_radix(&self, radix: u32) -> InRadix<'_>

Representation in a given radix.

§Panics

Panics if radix is not between 2 and 36 inclusive.

§Examples
assert_eq!(format!("{}", ubig!(83).in_radix(3)), "10002");
assert_eq!(format!("{:+010}", ubig!(35).in_radix(36)), "+00000000z");
source

pub fn gcd(&self, rhs: &UBig) -> UBig

Greatest common divisor.

§Example
assert_eq!(ubig!(12).gcd(&ubig!(18)), ubig!(6));
§Panics

ubig!(0).gcd(&ubig!(0)) panics.

source

pub fn extended_gcd(&self, rhs: &UBig) -> (UBig, IBig, IBig)

Greatest common divisors and the Bézout coefficients.

If a.extended_gcd(&b) == (g, x, y) then:

  • x * a + y * b == g
  • abs(x) <= max(b, 1)
  • abs(y) <= max(a, 1)
§Example
let a = ubig!(12);
let b = ubig!(18);
let (g, x, y) = a.extended_gcd(&b);
assert_eq!(&a % &g, ubig!(0));
assert_eq!(&b % &g, ubig!(0));
assert_eq!(&x * IBig::from(&a) + &y * IBig::from(&b), IBig::from(g));
assert!(x.unsigned_abs() <= b);
assert!(y.unsigned_abs() <= a);
§Panics

ubig!(0).extended_gcd(&ubig!(0)) panics.

source

pub fn pow(&self, exp: usize) -> UBig

Raises self to the power of exp.

§Example
assert_eq!(ubig!(3).pow(3), ubig!(27));
source

pub const MAX_BIT_LEN: usize = 9_223_372_036_854_775_808usize

Trait Implementations§

source§

impl Clone for DeletionResult

source§

fn clone(&self) -> DeletionResult

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DeletionResult

source§

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

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

impl Deref for DeletionResult

§

type Target = UBig

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V