Crate emstr

source ·
Expand description

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");

Modules

Helpers for more complex string encodings

Macros

Helper macro for joining EncodeStr types, returning the number of bytes written on success
Helper macro for joining EncodeStr types, returning a string slice on success

Enums

Error type for string encoding

Traits

EncodeStr implemented for string writable types