pub fn list_from_slice<T>(slice: &[T]) -> ListType<'_, T>where
T: Clone,Expand description
Converts a slice to the currently active ListType.
This function adapts to the current platform configuration:
- With
alloc: Creates aCow::Borrowedfrom the slice - Without
alloc: Returns the slice directly
ยงExamples
use veecle_telemetry::types::{ListType, list_from_slice};
let data = [1, 2, 3, 4, 5];
let list: ListType<'_, i32> = list_from_slice(&data);
assert_eq!(list.len(), 5);