Trait malachite_base::num::logic::traits::BitIterable
source · [−]pub trait BitIterable {
type BitIterator: DoubleEndedIterator<Item = bool> + Index<u64>;
fn bits(self) -> Self::BitIterator;
}
Expand description
Defines an iterator over a value’s bits.
Required Associated Types
type BitIterator: DoubleEndedIterator<Item = bool> + Index<u64>
Required Methods
fn bits(self) -> Self::BitIterator
fn bits(self) -> Self::BitIterator
Returns a double-ended iterator over a number’s bits. When iterating in the forward direction, the iterator ends after the producing the number’s most-significant bit.
Implementations on Foreign Types
sourceimpl BitIterable for u8
impl BitIterable for u8
sourcefn bits(self) -> PrimitiveUnsignedBitIterator<u8>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
fn bits(self) -> PrimitiveUnsignedBitIterator<u8>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
Returns a double-ended iterator over the bits of an unsigned primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing false bits going forward, or leading falses going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveUnsignedBitIterator<u8>
sourceimpl BitIterable for u16
impl BitIterable for u16
sourcefn bits(self) -> PrimitiveUnsignedBitIterator<u16>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
fn bits(self) -> PrimitiveUnsignedBitIterator<u16>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
Returns a double-ended iterator over the bits of an unsigned primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing false bits going forward, or leading falses going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveUnsignedBitIterator<u16>
sourceimpl BitIterable for u32
impl BitIterable for u32
sourcefn bits(self) -> PrimitiveUnsignedBitIterator<u32>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
fn bits(self) -> PrimitiveUnsignedBitIterator<u32>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
Returns a double-ended iterator over the bits of an unsigned primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing false bits going forward, or leading falses going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveUnsignedBitIterator<u32>
sourceimpl BitIterable for u64
impl BitIterable for u64
sourcefn bits(self) -> PrimitiveUnsignedBitIterator<u64>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
fn bits(self) -> PrimitiveUnsignedBitIterator<u64>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
Returns a double-ended iterator over the bits of an unsigned primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing false bits going forward, or leading falses going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveUnsignedBitIterator<u64>
sourceimpl BitIterable for u128
impl BitIterable for u128
sourcefn bits(self) -> PrimitiveUnsignedBitIterator<u128>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
fn bits(self) -> PrimitiveUnsignedBitIterator<u128>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
Returns a double-ended iterator over the bits of an unsigned primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing false bits going forward, or leading falses going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveUnsignedBitIterator<u128>
sourceimpl BitIterable for usize
impl BitIterable for usize
sourcefn bits(self) -> PrimitiveUnsignedBitIterator<usize>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
fn bits(self) -> PrimitiveUnsignedBitIterator<usize>ⓘNotable traits for PrimitiveUnsignedBitIterator<T>impl<T: PrimitiveUnsigned> Iterator for PrimitiveUnsignedBitIterator<T> type Item = bool;
Returns a double-ended iterator over the bits of an unsigned primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing false bits going forward, or leading falses going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveUnsignedBitIterator<usize>
sourceimpl BitIterable for i8
impl BitIterable for i8
sourcefn bits(self) -> PrimitiveSignedBitIterator<u8, i8>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
fn bits(self) -> PrimitiveSignedBitIterator<u8, i8>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
Returns a double-ended iterator over the bits of a signed primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing sign bits going forward, or leading sign bits going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveSignedBitIterator<u8, i8>
sourceimpl BitIterable for i16
impl BitIterable for i16
sourcefn bits(self) -> PrimitiveSignedBitIterator<u16, i16>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
fn bits(self) -> PrimitiveSignedBitIterator<u16, i16>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
Returns a double-ended iterator over the bits of a signed primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing sign bits going forward, or leading sign bits going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveSignedBitIterator<u16, i16>
sourceimpl BitIterable for i32
impl BitIterable for i32
sourcefn bits(self) -> PrimitiveSignedBitIterator<u32, i32>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
fn bits(self) -> PrimitiveSignedBitIterator<u32, i32>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
Returns a double-ended iterator over the bits of a signed primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing sign bits going forward, or leading sign bits going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveSignedBitIterator<u32, i32>
sourceimpl BitIterable for i64
impl BitIterable for i64
sourcefn bits(self) -> PrimitiveSignedBitIterator<u64, i64>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
fn bits(self) -> PrimitiveSignedBitIterator<u64, i64>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
Returns a double-ended iterator over the bits of a signed primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing sign bits going forward, or leading sign bits going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveSignedBitIterator<u64, i64>
sourceimpl BitIterable for i128
impl BitIterable for i128
sourcefn bits(self) -> PrimitiveSignedBitIterator<u128, i128>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
fn bits(self) -> PrimitiveSignedBitIterator<u128, i128>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
Returns a double-ended iterator over the bits of a signed primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing sign bits going forward, or leading sign bits going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type BitIterator = PrimitiveSignedBitIterator<u128, i128>
sourceimpl BitIterable for isize
impl BitIterable for isize
sourcefn bits(self) -> PrimitiveSignedBitIterator<usize, isize>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
fn bits(self) -> PrimitiveSignedBitIterator<usize, isize>ⓘNotable traits for PrimitiveSignedBitIterator<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned> Iterator for PrimitiveSignedBitIterator<U, S> type Item = bool;
Returns a double-ended iterator over the bits of a signed primitive integer.
The forward order is ascending, so that less significant bits appear first. There are no trailing sign bits going forward, or leading sign bits going backward.
If it’s necessary to get a Vec
of all the bits, consider using
to_bits_asc
or
to_bits_desc
instead.
Worst-case complexity
Constant time and additional memory.
Examples
See here.