Struct analiticcl::iterators::DeletionResult
source · pub struct DeletionResult {
pub value: AnaValue,
pub charindex: CharIndexType,
}
Fields§
§value: AnaValue
§charindex: CharIndexType
Methods from Deref<Target = AnaValue>§
sourcepub fn bit(&self, n: usize) -> bool
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);
sourcepub fn trailing_zeros(&self) -> Option<usize>
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);
sourcepub fn bit_len(&self) -> usize
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());
sourcepub fn is_power_of_two(&self) -> bool
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);
sourcepub fn to_le_bytes(&self) -> Vec<u8> ⓘ
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]);
sourcepub fn to_be_bytes(&self) -> Vec<u8> ⓘ
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]);
sourcepub fn to_f32(&self) -> f32
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);
sourcepub fn to_f64(&self) -> f64
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);
sourcepub fn extended_gcd(&self, rhs: &UBig) -> (UBig, IBig, IBig)
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.
pub const MAX_BIT_LEN: usize = 9_223_372_036_854_775_808usize
Trait Implementations§
source§impl Clone for DeletionResult
impl Clone for DeletionResult
source§fn clone(&self) -> DeletionResult
fn clone(&self) -> DeletionResult
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DeletionResult
impl Debug for DeletionResult
Auto Trait Implementations§
impl Freeze for DeletionResult
impl RefUnwindSafe for DeletionResult
impl Send for DeletionResult
impl Sync for DeletionResult
impl Unpin for DeletionResult
impl UnwindSafe for DeletionResult
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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