4 releases

0.2.0 Feb 6, 2023
0.1.2 Jan 23, 2023
0.1.1 Jan 22, 2023
0.1.0 Jan 20, 2023

#2156 in Embedded development

Download history 23/week @ 2025-10-16 37/week @ 2025-10-23 97/week @ 2025-10-30 22/week @ 2025-11-06 40/week @ 2025-11-13 25/week @ 2025-11-20 53/week @ 2025-11-27 87/week @ 2025-12-04 68/week @ 2025-12-11 17/week @ 2025-12-18 6/week @ 2025-12-25 19/week @ 2026-01-01 68/week @ 2026-01-08 83/week @ 2026-01-15 57/week @ 2026-01-22 52/week @ 2026-01-29

264 downloads per month

MPL-2.0 license

22KB
533 lines

Helpers for string concatenation / encoding / manipulation in an embedded no_std / alloc free environment

See [EncodeStr] for the base encode trait, and [write!] for constructing strings


// context can be any types implementing [emstr::EncodeStr]
let name = "something";
let progress = 15u8;

// use [emstr::write!]` macro to concatentate encodable types into `buff`
let mut buff = [0u8; 32];
let n = emstr::write!(&mut buff[..], name, ' ', progress, '/', 100u8).unwrap();

// creating the expected output
assert_eq!(&buff[..n], b"something 15/100");

emstr

no_std and alloc-free string building and encoding for embedded firmware in rust.

This crate provides an EncodeStr trait for string encoding and implementations for basic types, as well as a write! macro for building strings from encodable objects, roughly equivalent to alloc::format! except using pre-allocated buffers.

Status

GitHub tag Build Status Crates.io Docs.rs

Dependencies

~225KB