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: Uses Cow<'_, str> for strings and Cow<'_, [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§

ListType
A list type which changes depending on the platform.
StringType
A string type which changes depending on the platform.