printf-rs

Crates.ioprintf-rs
lib.rsprintf-rs
version0.1.1
sourcesrc
created_at2019-01-11 19:16:52.874012
updated_at2019-01-12 05:31:25.495634
descriptionprintf c language like
homepagehttps://github.com/robatipoor/printf-rs
repositoryhttps://github.com/robatipoor/printf-rs
max_upload_size
id107996
size4,843
Mahdi (robatipoor)

documentation

https://github.com/robatipoor/printf-rs

README

prinf macro in rust

Crates.io

add to Cargo.toml dependencies

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

Example 1

use printf_rs::*;

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

Example 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));
    }
}
Commit count: 0

cargo fmt