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

An append-only pool of auto-overlapping binary slices.

In use, you add binary slices one at a time and it will attempt to create maximum overlapping. Currently, it only guarantees that supersets and subsets will overlap. It’s theoretically possible to do cross-slice overlapping, but this would be complex and even more expensive.

Slices added to the pool are guaranteed to remain in insertion order. Moreover, the collection is append-only, so once a slice is added it will remain at the same index for the lifetime of the BinPool.

Implementations

Constructs an empty pool.

Adds the specified slice to the pool. If an equivalent slice already exists, does nothing and returns the index of the pre-existing slice; otherwise, adds value as a new slice and returns its (new) slice index.

If you are working with strings, you may find str::as_bytes and String::into_bytes useful.

Removes all content from the pool. This is the only non-append-only operation, and is just meant to support resource reuse.

Gets the number of (distinct) slices contained in the pool.

Checks if the pool is empty.

Iterates over all (distinct) slices contained in the pool in insertion order.

Gets the slice at the specified index, or None if index is not a valid slice index returned by BinPool::add.

Gets the total number of bytes from (distinct) slices that were added to the pool. Note that the space needed to represent these slices may be significantly smaller (see BinPool::backing_bytes).

Gets the total number of bytes backing the stored slices.

Gets a reference to the backing data.

Gets the backing data.

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

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

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 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

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.