File: README.md

package info (click to toggle)
rust-sprintf 0.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 140 kB
  • sloc: makefile: 2
file content (23 lines) | stat: -rw-r--r-- 662 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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:

```rust
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.