#printf #print #clang #format

已删除 printf-rs

C语言风格的printf

0.1.1 2019年1月12日
0.1.0 2019年1月11日

13 in #printf

MIT 许可证

4KB

Rust中的prinf宏

Crates.io

添加到Cargo.toml依赖项

[dependencies]
printf-rs = "0.1.0"
libc = "0.2.46"

示例1

use printf_rs::*;

fn main() {
    printf!("%s \n", cstr!("Hello World !")); // print string
    printf!("%i \n", 1234); // print integer
}

示例2

use printf_rs::*;
use std::thread::sleep;
use std::time::Duration;
fn main() {
    let chars = vec!['a','b','c','d','e','f'];
    // print char with \r (carriage return) Moves the active position to the initial position of the current line.
    for c in chars {
        printf!("\r %lc ",c);
        sleep(Duration::from_secs(2));
    }
}

依赖项

~52KB