Crate triple_arena

source ·

Modules

Iterators for Arena

Macros

Convenience macro for quickly making new structs that implement Ptr. By default, usize is used for the index type and NonZeroU64 is used for the generation type. The struct name can be followed by square brackets containing the type used for the index which can include u8 through u128. After the optional square brackets, optional parenthesis can be added which contain the the generation type which can be NonZeroU8 through NonZeroU128. The parenthesis can also be empty in which case the Arena will not use generation counters. This all can be followed by a comma separated list of attributes.

Structs

An arena supporting non-Clone T (T has no requirements other than Sized, but some traits are only active if T implements them), deletion, and optional generation counters. The index and generation types can be changed to be smaller for less memory footprint in exchange for smaller maximum capacity.
This is a specially managed Arena for handling usecases involving O(1) insertion, deletion, and other functions on linear lists of elements that we call “chains” of “links”. The arena supports multiple chains and cyclical chains.
This represents a link in a ChainArena that has a public t: T field and Option<Ptr<PLink>> interlinks to the previous and next links. Note that Deref and DerefMut are implemented to grant direct access to the methods on T. The interlinks are private and only accessible through methods so that the whole Link can be returned by indexing the arena without worrying about accidentally breaking the links (preventing a lot of cumbersome code when traversing chains).

Traits

A trait containing index and generation information for the Arena type. This crate supplies the ptr_struct macro for automatically implementing types implementing this trait efficiently. The PartialEq/Eq implementation should differentiate between pointers at the same index but different generation. Default should use the invalid function.