Skip to content

`self_referential_elements` module

Compare
Choose a tag to compare
@orxfun orxfun released this 02 Jan 21:37
· 57 commits to main since this release
fdea967

self_referential_elements

orx_pinned_vec::self_referential_elements module is created. This method defines all traits required to conveniently, efficiently and simply define inter-element references of a self-referential-collection.

There are three variants for each of next and prev references:

  • single
  • multiple references with dynamic sized (vec)
  • multiple references const capacity (const array)

Each node can define required traits.

For instance a linked list node would only require the single-next. A doubly-linked-list node would additionally implement single-prev trait.

A tree on the other hand can implement single-prev to define the parent of a node and a dynamic sized vec to define its children. This can be replaced by a constant capacity array for a binary search tree, for instance.

Also

  • iter_mut is added to the trait definition.