Trait sharded_slab::Config[][src]

pub trait Config: Sized {
    const MAX_THREADS: usize;
    const MAX_PAGES: usize;
    const INITIAL_PAGE_SIZE: usize;
    const RESERVED_BITS: usize;
}

Configuration parameters which can be overridden to tune the behavior of a slab.

Associated Constants

const MAX_THREADS: usize[src]

The maximum number of threads which can access the slab.

This value (rounded to a power of two) determines the number of shards in the slab. If a thread is created, accesses the slab, and then terminates, its shard may be reused and thus does not count against the maximum number of threads once the thread has terminated.

const MAX_PAGES: usize[src]

The maximum number of pages in each shard in the slab.

This value, in combination with INITIAL_PAGE_SIZE, determines how many bits of each index are used to represent page addresses.

const INITIAL_PAGE_SIZE: usize[src]

The size of the first page in each shard.

When a page in a shard 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.

Note that page sizes must be powers of two. If this value is not a power of two, it will be rounded to the next power of two.

const RESERVED_BITS: usize[src]

Sets a number of high-order bits in each index which are reserved from user code.

Note that these bits are taken from the generation counter; if the page address and thread IDs are configured to use a large number of bits, 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.

Loading content...

Implementors

impl Config for DefaultConfig[src]

Loading content...