#combinator #no-std #zero-copy #const-generics #environment #heap-allocator

no-std combined_str

Zero-copy, const-generic string combinator for no_std environments

7 releases

Uses new Rust 2024

0.4.3 Mar 23, 2026
0.4.2 Mar 23, 2026
0.3.0 Mar 23, 2026
0.2.1 Mar 23, 2026

#2395 in Rust patterns

MIT license

27KB
587 lines

combined_str

docs.rs

A no_std Rust library providing CombinedStr, a zero-copy, const-generic string combinator that holds N string slices and presents them as a single logical string — without allocating.

Features

  • no_std compatible — works in embedded and bare-metal environments
  • Zero-copy — holds &str references, no heap allocation required
  • alloc feature — enables conversion to String and Cow<str>, plus += / + operators and equality comparisons
  • Display — prints all segments as one contiguous string
  • Iterator — iterate over the individual &str segments

Usage

[dependencies]
combined_str = "0.4"
use combined_str::strs;

let s = strs!["hello", ", ", "world"];
println!("{}", s);          // hello, world
assert_eq!(s.len(), 12);

Feature flags

Flag Default Description
alloc enabled Enables String/Cow support via the alloc crate
nightly disabled Enables generic_const_exprs for CombinedStr<N> + CombinedStr<M> and CombinedStr<N> + &str

License

MIT

No runtime deps

Features