pub trait Config: Sized {
const INITIAL_PAGE_SIZE: u32 = 32u32;
const MAX_PAGES: u32 = 27u32;
const RESERVED_BITS: u32 = 0u32;
// Provided method
fn debug() -> impl Debug { ... }
}Expand description
Configuration parameters to tune the behavior of an IDR.
The capacity of an IDR is determined by the configuration parameters:
(2**MAX_PAGES - 1) * INITIAL_PAGE_SIZE
Idr::new() checks that the configuration is valid at compile time.
These checks are triggered by cargo build or cargo test, but not
by cargo check.
Provided Associated Constants§
sourceconst INITIAL_PAGE_SIZE: u32 = 32u32
const INITIAL_PAGE_SIZE: u32 = 32u32
The capacity of the first page.
When a page in an underlying slab has been filled with values, a new page will be allocated that is twice as large as the previous page. Thus, the second page will be twice this size, and the third will be four times this size, and so on.
Must be a power of two.
sourceconst MAX_PAGES: u32 = 27u32
const MAX_PAGES: u32 = 27u32
The maximum number of pages in an underlying slab of an IDR.
This value, in combination with INITIAL_PAGE_SIZE, determines how many
bits of each key are used to represent slot indices.
Must be positive.
sourceconst RESERVED_BITS: u32 = 0u32
const RESERVED_BITS: u32 = 0u32
A number of high-order bits which are reserved from user code.
Note: these bits are taken from the generation counter; reserving additional bits will decrease the period of the generation counter. These should thus be used relatively sparingly, to ensure that generation counters are able to effectively prevent the ABA problem.
Must be less than or equal to 32.