Struct rxing::common::BitArray

source ·
pub struct BitArray { /* private fields */ }
Expand description

A simple, fast array of bits, represented compactly by an array of ints internally.

@author Sean Owen

Implementations§

@param i bit to get @return true iff bit i is set

Sets bit i.

@param i bit to set

Flips bit i.

@param i bit to set

@param from first bit to check @return index of first bit that is set, starting from the given index, or size if none are set at or beyond this given index @see #getNextUnset(int)

@param from index to start looking for unset bit @return index of next unset bit, or {@code size} if none are unset until the end @see #getNextSet(int)

Sets a block of 32 bits, starting at bit i.

@param i first bit to set @param newBits the new value of the next 32 bits. Note again that the least-significant bit corresponds to bit i, the next-least-significant to i+1, and so on.

Sets a range of bits.

@param start start of range, inclusive. @param end end of range, exclusive

Clears all bits (sets to false).

Efficient method to check if a range of bits is set, or not set.

@param start start of range, inclusive. @param end end of range, exclusive @param value if true, checks that bits in range are set, otherwise checks that they are not set @return true iff all bits are set or not set in range, according to value argument @throws IllegalArgumentException if end is less than start or the range is not contained in the array

Appends the least-significant bits, from value, in order from most-significant to least-significant. For example, appending 6 bits from 0x000001E will append the bits 0, 1, 1, 1, 1, 0 in that order.

@param value {@code int} containing bits to append @param numBits bits from value to append

@param bitOffset first bit to start writing @param array array to write into. Bytes are written most-significant byte first. This is the opposite of the internal representation, which is exposed by {@link #getBitArray()} @param offset position in array to start writing @param numBytes how many bytes to write

@return underlying array of ints. The first element holds the first 32 bits, and the least significant bit is bit 0.

Reverses all bits in the array.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
The error type produced by a failed conversion.
Convert the given value into an approximately equivalent representation.
The error type produced by a failed conversion.
Convert the subject into an approximately equivalent representation.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Approximate the subject with the default scheme.
Approximate the subject with a specific scheme.
Approximate the subject to a given type with the default scheme.
Approximate the subject to a given type with a specific scheme.
Convert the subject to a given type.
Attempt to convert the subject to a given type.
Attempt a value conversion of the subject to a given type.

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The error type produced by a failed conversion.
Convert the given value into the subject type.
The type returned in the event of a conversion error.
Performs the conversion.
The error type produced by a failed conversion.
Convert the subject into the destination type.
The type returned in the event of a conversion error.
Performs the conversion.
The error type produced by a failed conversion.
Convert the given value into an exactly equivalent representation.
The error type produced by a failed conversion.
Convert the subject into an exactly equivalent representation.