Module types
Expand description
Type definitions that adapt to different platform capabilities.
This module provides type aliases and utilities that adapt to the current
platform configuration.
The types change behavior based on available features, allowing the same code to work efficiently in both std
and
no_std
environments.
§Platform Adaptation
- With
alloc
: UsesCow<'_, str>
for strings andCow<'_, [T]>
for lists - Without
alloc
: Uses&str
for strings and&[T]
for lists
This design allows for efficient zero-copy operation in no_std
environments
while providing flexibility for owned data when allocation is available.
§Examples
use veecle_telemetry::types::{ListType, StringType, list_from_slice};
// StringType adapts to the platform
let message: StringType = "Hello, world!".into();
// ListType adapts to the platform
let data = [1, 2, 3, 4, 5];
let list: ListType<'_, i32> = list_from_slice(&data);
Functions§
- list_
from_ slice - Converts a slice to the currently active
ListType
.
Type Aliases§
- List
Type - A list type which changes depending on the platform.
- String
Type - A string type which changes depending on the platform.