pub fn sorted_str(data: &[&str]) -> Vec64<String>Expand description
Creates a new sorted collection of owned strings from string references.
Copies string references into owned String objects within a Vec64 container and sorts them lexicographically. Returns a new sorted collection while preserving the original string references for scenarios requiring owned string data.
§Parameters
data: Source slice of string references to be copied and sorted
§Returns
A new Vec64<String> containing owned, sorted string copies from the input references.
§Memory Allocation
- String allocation: Each string reference copied into a new String object
- Container allocation: Vec64 provides 64-byte aligned storage for optimal performance
- Heap usage: Total memory proportional to sum of string lengths plus container overhead
§Performance Characteristics
- O(n) string allocation and copying (proportional to total string length)
- O(n log n) sorting time complexity with string comparison overhead
- Memory overhead: Requires additional heap space for all string content
§String Ownership
- Input references: Original string references remain unchanged
- Output strings: New owned String objects independent of input lifetime
- Memory management: Vec64
handles automatic cleanup of owned strings
§Usage Example
ⓘ
use simd_kernels::kernels::sort::sorted_str;
let words = ["zebra", "apple", "banana", "cherry"];
let sorted = sorted_str(&words);
// sorted contains owned Strings: ["apple", "banana", "cherry", "zebra"]
// original words slice unchanged