Releases: orxfun/orx-pinned-vec
Iterator over range
iter_over_range
method is provided.
At one hand, vec.iter_over_range(a..b)
is equivalent to vec.iter().skip(a).take(b - a)
. However, the latter requires a
unnecessary next
calls. Since all pinned vectors provide random access to elements, the objective of iter_over_range
is to directly jump to a
and create an iterator from this point on, and hence, avoiding the unnecessary iterations at the beginning.
Also
- vec_range_limits helper method is also provided.
Support for Self Referential Collections
The following methods are required by pinned vectors:
- index_of_ptr
- push_get_ptr
- iter_ptr
- iter_ptr_rev
- contains_ptr
- get_ptr
Crate is converted to no_std
Merge pull request #33 from orxfun/no-std library is converted to no_std
Reserve initiated capacity
reserve_maximum_concurrent_capacity_fill_with
method is required.
Concurrent Clone and Fill methods are defined
- clone_with_len is required for thread safe cloning of data.
- fill_with, on the other hand, is required for data structures that needs to be gap-free all the time.
Index and IndexMut traits are required
Merge pull request #29 from orxfun/index-and-index-mut-are-required Index and IndexMut traits are required
sort methods are required by the PinnedVec trait
Merge pull request #28 from orxfun/sort-methods-added-to-trait sort, sort_by, sort_by_key are required
Fill-with initialization on concurrent growth
into_concurrent_filled_with
and grow_to_and_fill_with
methods are required to enable data structures which always have an initialized and valid state.
Support for Concurrency
Support for Concurrency
In version 2, PinnedVec grew with new methods to support concurrent data structures. However, this caused problems since these exposed methods were often unsafe, and further, they were not directly useful for the pinned vector consumers except for concurrent data structures wrapping a pinned vector. Furthermore, they are alien to a regular vector interface that we are used to using.
In version 3, a second trait called ConcurrentPinnedVec
is defined. All useful methods related with concurrent programming are moved to this trait. This trait has an associated type defining the underlying pinned vector type. It can be turned into the pinned vector.
Finally, IntoConcurrentPinnedVec
trait is defined. A pinned vector implementing this trait can be turned into a ConcurrentPinnedVec
. As explained above, it can be converted back to the pinned vector.
This bi-directional transformation allows to wrap pinned vector to have concurrent support, and unwrap whenever concurrency is not required anymore.
An important advantage of this approach is that it allowed to clean up the PinnedVec
api from unsafe and alien concurrency related methods.
Also
Tests using clock are revised so that currently pinned vector tests are miri safe.
PseudoDefault
is required for all pinned vectors. Note that a FixedVec
cannot implement a Default
, but as any type, it can implement a pseudo-default, which is also required for concurrent wrappers.
slices iterators require Default
2.12.0 Merge pull request #23 from orxfun/Default-trait-bound-for-slices-ite…