pub struct Index { /* private fields */ }
Expand description

A chunk file providing a table into the parent data.

Implementations

Provided a mapped file at the beginning via data, starting at toc_offset decode all chunk information to return an index with num_chunks chunks.

The size of a single index entry in bytes

The smallest possible size of an index, consisting only of the sentinel value pointing past itself.

Returns the size in bytes an index with num_entries would take.

Find a chunk of kind and return its offset into the data if found

Find a chunk of kind and return its offset as usize range into the data if found.

Panics
  • if the usize conversion fails, which isn’t expected as memory maps can’t be created if files are too large to require such offsets.

Like Index::usize_offset_by_id() but with support for validation and transformation using a function.

Find a chunk of kind and return its data slice based on its offset.

Return the end offset lf the last chunk, which is the highest offset as well. It’s definitely available as we have one or more chunks.

Writing

Create a new index whose sole purpose is to be receiving chunks using plan_chunk() and to be written to an output using into_write()

Plan to write a new chunk as part of the index when into_write() is called.

Return the total size of all planned chunks thus far.

Return the amount of chunks we currently know.

After planning all chunks call this method with the destination to write the chunks to. Use the Chunk writer to write each chunk in order. current_offset is the byte position at which out will continue writing.

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.