pub fn try_bimodal_array<T>(
data: Vec<T>,
) -> Result<(ArrayHandle<T>, Vec<ElementHandle<T>>), BimodalArrayError>Expand description
Constructs a bimodal array from an owned Vec<T>.
This is the fallible constructor. On success, it returns:
- an
ArrayHandle<T>, which can be used to acquire anArrayGuard<T>for exclusive access to the full slice, and - a
Vec<ElementHandle<T>>, containing one handle per element, each of which can be used to acquire anElementGuard<T>for element-level access.
The returned handles enable a scatter–gather access pattern: independent workers can lock and update different elements concurrently, followed by an orchestration step that locks the entire array for consolidation.
§Errors
Returns BimodalArrayError::UnsupportedLength if the length of data is
not supported by the internal state encoding (currently usize::MAX).
Returns BimodalArrayError::AllocationFailed if allocating fails.