Emio
A safe and fast high-level and low-level character input/output library for bare-metal and RTOS based embedded systems with a very small binary footprint.
Install / Use
/learn @Viatorus/EmioREADME

em{io} is a safe and fast high-level and low-level character input/output library for bare-metal and RTOS based embedded systems with a very small binary footprint.
// High-level
std::string str = emio::format("The answer is {}.", 42); // Format argument.
int answer{};
emio::result<void> scan_res = emio::scan(str, "The answer is {}.", answer); // Scan input string.
if (scan_res) {
emio::print("The answer is {}.", answer); // Output to console.
}
// Without using heap.
emio::static_buffer<128> buf{};
emio::format_to(buf, "The answer is {:#x}.", 42).value();
buf.view(); // <- The answer is 0x2a.
// Low-level
emio::writer wrt{buf};
wrt.write_str(" In decimal: ").value();
wrt.write_int(42).value();
wrt.write_char('.').value();
buf.view(); // <- The answer is 0x2a. In decimal: 42.
emio::reader rdr{"17c"};
EMIO_TRY(uint32_t number, rdr.parse_int<uint32_t>()); // <- 17
EMIO_TRY(char suffix, rdr.read_char()); // <- c
This library is in beta status! Please help to make it fly!
- API documentation
- Try emio online.
Yet another character input/output library
Bare-metal and RTOS based embedded systems do have special requirements which are mostly overlooked by the C++ standard, its implementations and other libraries.
Therefore, this library:
- has a very small binary footprint (~38 times smaller than fmtlib!)
- returns a result object instead of throwing an exception
- provides a high-level and low-level API which can be used at compile-time
Read more about it in the DESIGN document.
Including emio in your project
- With CMake and fetch content
FetchContent_Declare(
emio
GIT_TAG main
GIT_REPOSITORY https://github.com/Viatorus/emio.git
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(emio)
- Download the single header file generated with Quom
- From Conan Center
A compiler supporting C++20 is required. Tested with GCC 11/12/13 and Clang 16/17.
Contributing
See the CONTRIBUTING document.
Licensing
em{io} is distributed under the MIT license.
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
