fn try_alloc_iter<T>(
iter: impl ExactSizeIterator<Item = Option<T>>,
) -> Option<&'static [T]>
Expand description
Attempts to allocate items from an iterator within a thread-local memory arena.
The function takes an iterator of optional items and tries to collect these items into a Bump
-allocated vector within a thread-local storage arena
.
This is achieved by using the collect_in
method, which collects items into a Bump
allocator.
If the collection is successful, the function converts the vector into a bump slice, returning a static reference to the slice.
If any item in the iterator is None
, or if the allocation fails, the function returns None
, indicating that the items could not be allocated in the bump arena.