sprintf

Crates.iosprintf
lib.rssprintf
version0.3.1
sourcesrc
created_at2021-08-24 18:43:45.927167
updated_at2024-07-14 16:49:10.696634
descriptionClone of C s(n)printf in Rust
homepage
repositoryhttps://github.com/tjol/sprintf-rs
max_upload_size
id441805
size39,199
Thomas Jollans (tjol)

documentation

README

sprintf-rs

a clone of C sprintf in Rust

This crate was created out of a desire to provide C printf-style formatting in a WASM program, where there is no libc.

Note: You're probably better off using standard Rust string formatting instead of this crate unless you specificaly need printf compatibility.

This crate implements a dynamically type-checked function vsprintf and macro sprintf!.

Usage example:

use sprintf::sprintf;
let s = sprintf!("%d + %d = %d\n", 3, 9, 3+9).unwrap();
assert_eq!(s, "3 + 9 = 12\n");

libc is a dev dependency as it is used in the tests to compare results. std is used for some maths functions.

Commit count: 23

cargo fmt