Struct llvm_bitcursor::BitCursor[][src]

pub struct BitCursor<T: AsRef<[u8]>> { /* fields omitted */ }
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.

Create a new BitCursor for the inner buffer, limiting to byte_len bytes.

Returns an error if byte_len exceeds inner’s range.

Return the length of the data wrapped by this cursor, in bytes.

Return the length of the data wrapped by this cursor, in bits.

Return the current position in the data, at bit granularity.

Return the current position in the data, at byte granularity.

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.

Align the stream on the next 32-bit boundary.

Any data consumed during alignment is discarded.

Trait Implementations

Formats the value using the given formatter. Read more

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.

Seek to an offset, in bytes, in a stream. Read more

Returns the current seek position from the start of the stream. Read more

🔬 This is a nightly-only experimental API. (seek_stream_len)

Returns the length of this stream (in bytes). Read more

Rewind to the beginning of a stream. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.