Struct llvm_bitcursor::BitCursor [−][src]
Expand description
A no-copy cursor wrapper for a bitstream.
Any type that implements AsRef<[u8]> can be used with BitCursor.
Implementations
Create a new BitCursor for the inner buffer, limiting to byte_len bytes.
Returns an error if byte_len exceeds inner’s range.
Return whether the underlying data is “exhausted”, i.e. whether it’s impossible to read any further from the cursor’s current position.
Seek to the given bit-granular position in the bitstream.
NOTE: This is a bit-granular absolute seek. If you only need byte granularity
or would like to do a relative (start or end) seek, use the Seek
implementation.
Read nbits bits of data at the current position. The data is returned
as a u64.
Returns an error if the requested read is invalid (e.g. EOF or not enough data)
or if nbits is invalid (zero, or >= u64::BITS).
Read a nbits of data at the current position into the given scalar type.
Returns an error under all of the same conditions as read,
as well as if the read value doesn’t fit into the given scalar.
Read exactly the size of Int at the current position.
Returns an error under all of the same conditions as read.
Read a width-wide VBR-encoded integer.
This function returns only unsigned integers. For signed integers,
use read_svbr.
Return a width-side signed VBR-encoded integer from cursor.
This function returns only signed integers, assuming LLVM’s signed VBR representation.
Trait Implementations
A Seek implementation for BitCursor.
Seeking past the end of a BitCursor is always invalid, and always returns
an error.
NOTE: This is a byte-granular implementation of Seek.
For bit-granular seeking, use seek_bit.