Releases: orxfun/orx-pinned-vec
Releases · orxfun/orx-pinned-vec
`contains_reference` & `set_len`
PinnedVec::contains_reference
method is added to the trait definition. This method is expected to return true wheneverindex_of
returnsSome
. However, since thecontains_reference
requires less work and can return faster, a default implementation is not provided.- Helper method
slice::contains_reference
is implemented and made available to be used by the trait implementers. set_len
method is required.
Also
rand
andrand_chacha
dependencies are removed. These had been used only for creating random indices for theRefMap
struct, which is then used bytest_pinned_vec
method. Anstd::time
random index generator is used instead, which is good enough for this scenario.
major refactoring applied
The following major revision is applied to the pinned vector:
- pinned elements guarantee is formalized and documented,
- unsafe methods such as
clone
orinsert
are now safe. pinned vector on its own cannot build inter-element references; hence, these methods are not unsafe. this responsibility is passed to the struct enabling these references, namely, orx_selfref_col. - in addition to being a marker trait, this crate now provides
test_pinned_vec
function which is essential in asserting that a pinned vector implementation satisfies the required guarantees.
Documentation revised wrt LinkedList:1.0 impl
Merge pull request #9 from orxfun/documentation documentation revised wrt LinkedList impl
`self_referential_elements` module
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.